Shell calls window commands to interact with each other

Source: Internet
Author: User

Linux Shell is a command binder in Linux. It is easy to combine those tools to make a more powerful tool or automate the work at hand.

Batch is also available in windows, and this function is also available in theory. However, its syntax and functions are different from those of Linux Shell.

If some commands only have the window version, if you use linuxshell to call the window command and pass the parameter?

Q: How can I combine the shell and tools on Linux with the commands on windows?

The answer is cywin.

Cywin: simulates the Linux Operating Environment on Windows, and can call the original window command.

For example:

    for   I in  $ (  ls-r  )   
DO
out =$ ( . / test . EXE $ I) # invoke the window program with the parameter from shell .
echo $ out
done

You can directly call the Linux Command and run the window command without the batch syntax that is hard to write in windows.

AnotherQ: How to Use wine to replace cywin and run the window command on Linux?

 For  I in  $ (  Ls-R  )  

Do

# In Linux environment , It will invoke the window Command Through wine
# Redirect the output of wine to null
Out = $ (wine Test . EXE $ I 2 >/ Dev / Null) Echo $ out

Done

It can also run well. This is also a solution.

HoweverProgramCywin is recommended when it cannot run on wine.

In addition, there is also a powerful tool:Ipython.

This is a basic python, cross-platform, supporting shell interaction with Linux/window. It supports "!" Operator, which can call system commands. It is worth a try.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.