简体   繁体   English

无法在Windows中的Makefile中运行“启动”命令

[英]cannot run 'start' command from makefile in windows

I am using gnu make 3.8.1 (mingw32) in Windows 7 operating system. 我在Windows 7操作系统中使用gnu make 3.8.1(mingw32)。 I want to run 'start' command from makefile but it is giving some error. 我想从makefile运行'start'命令,但是它给出了一些错误。 my syntax of command is- 我的命令语法是-

start CMD /K http-server ./www -c-1

This command works when manually typed in cmd. 在cmd中手动键入时,此命令有效。 It opens a new command prompt which runs the command 'http-server ./www -c-1', hosts the files present in www folder of current directory on port 8080 and shows the logs in the command prompt window it opened. 它将打开一个新的命令提示符,该命令提示符将运行命令'http-server ./www -c-1',托管当前端口8080当前目录的www文件夹中的文件,并在打开的命令提示符窗口中显示日志。 but in makefile, it doesn't seems to work. 但是在makefile中,它似乎不起作用。 My makefile is- 我的makefile是-

hostx:
    start CMD /K http-server ./www -c-1

There is more to the makefile but we only need to focus on this part. makefile还有更多内容,但是我们只需要关注这一部分。 when i type 'make hostx' in cmd it shows the following output. 当我在cmd中键入'make hostx'时,它显示以下输出。 I am posting my cmd output as complete image so this is more clear 我将cmd输出发布为完整图像,这样更清晰

我的命令提示符输出

any ideas how i could get it to work? 任何想法,我怎么可以让它工作? also i don't know what does this error mean. 我也不知道这个错误是什么意思。

Only Windows 95/98/ME have a program called start.exe, in other versions of Windows it is an internal command inside cmd.exe. 仅Windows 95/98 / ME具有名为start.exe的程序,在Windows的其他版本中,它是cmd.exe中的内部命令。

To use the start command you need to invoke cmd.exe first: 要使用启动命令,您需要首先调用cmd.exe:

CMD /C start CMD /K http-server ./www -c-1

If http-server is a console program or batch file then you don't need the CMD /K part because Windows will create a new console automatically. 如果http-server是控制台程序或批处理文件,则不需要CMD / K部分,因为Windows会自动创建一个新的控制台。 CMD /C start http-server ./www -c-1 should be enough. CMD /C start http-server ./www -c-1应该足够了。

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

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