简体   繁体   English

通过命令行在Cygwin环境中启动C程序

[英]Launch C program in Cygwin Environment through command line

I installed Cygwin to compile and run C programs. 我安装了Cygwin来编译和运行C程序。 I'm trying to write my own shell program using Notepad++ as my editor. 我正在尝试使用Notepad ++作为编辑器来编写自己的Shell程序。 When I execute the compiled .exe file from the command line (using nppexec) it runs outside the Cygwin environment. 当我从命令行(使用nppexec)执行编译的.exe文件时,它在Cygwin环境之外运行。
The following redirect command won't run with Window's cmd: 以下重定向命令无法与Window的cmd一起运行:

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

But works when the program is executed through Cygwin's Mintty: 但是在通过Cygwin的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: 我正在使用以下代码与nppexec一起运行以启动程序:

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? 如何编辑以上内容以在Cygwin环境中启动?
I've tried with no luck: 我尝试过没有运气:

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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