简体   繁体   中英

Launch C program in Cygwin Environment through command line

I installed Cygwin to compile and run C programs. I'm trying to write my own shell program using Notepad++ as my editor. When I execute the compiled .exe file from the command line (using nppexec) it runs outside the Cygwin environment.
The following redirect command won't run with Window's cmd:

$ sort -r < test3.txt
-rThe system cannot find the file specified.

But works when the program is executed through Cygwin's Mintty:

$ sort -r < test3.txt
test3.txt
test.txt
sh.exe
sh.c
1.txt

I'm using the following code to run with nppexec to launch the program:

cd $(CURRENT_DIRECTORY)

gcc "$(FILE_NAME)" -o $(NAME_PART).exe

cmd.exe /c start cmd /k $(NAME_PART).exe

How do I edit the above to launch in the Cygwin Environment?
I've tried with no luck:

cmd /c start mintty ./$(NAME_PART).exe

Windows命令行具有自己的 sort命令,其行为与通过Cygwin命令行提供的变体不同。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM