控制台 exe(用 C# 制作)从 cmd 提示符运行,但不能从 Windows 7 上的批处理文件运行
我记得我曾经写过.bat
call myprog.exe
但dos 说call 不是命令?!!
我的问题不是关于 cmd 提示符而是关于 BATCH 文件。
我也尝试过
c:\some-path\myprog.exe
,但
"c:\some-path\myprog.exe"
出现错误消息:exe 不是可识别的内部命令。这是一个用 C# 制作的控制台应用程序,如果我直接在 cmd 提示符中启动它而不是批量更新,它就会运行
更新:第 2 个字符输出很奇怪,有一些奇怪的 2 个字符我认为这是因为我安装了 msysgit 客户端 http://code.google.com/p/msysgit/ 它以某种方式为命令提示符做了一些事情。
希望我可以卸载它...
我卸载了它,但在我的命令前面仍然有奇怪的字符:
'´++"C:\some-path\prog-example.exe"' is not recognized ...
I remember I used to write in a .bat
call myprog.exe
But dos says call not a command ?!!
My question is not about cmd prompt but BATCH file.
I tried also
c:\some-path\myprog.exe
and
"c:\some-path\myprog.exe"
the error message: the exe is not a recognized internal command. It is a console application made in C# which runs if I launch it directly in cmd prompt not in batch
Update: the 2 first character ouput is weird there are some weird 2 chars I think it happens since I installed msysgit client http://code.google.com/p/msysgit/ which has somehow made something to command prompt.
Hope I can uninstall it...
I uninstalled it but still got the weird chars in front of my command:
'´++"C:\some-path\prog-example.exe"' is not recognized ...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您已包含 exe 文件的完整路径。另外,如果路径中的任何目录有空格,请不要忘记将整个文本放在引号中。
示例:
注意:如果您创建了一个批处理文件并且没有按您的预期工作。从命令提示符运行批处理文件,它将显示错误消息。
You have include full path for the exe file. Also if any of your directories in the path has spaces, don't forget to include the whole text in quotes.
Example:
Note: If you create a batch file and does not work as you expected. Run the batch file from command prompt and it will display the error message.
“call”仅用于运行另一个批处理文件。
正如 shoban 所说,只需使用 .exe 的名称
"call" is only used for running another batch file.
As shoban says, just use the name of the .exe
您还可以使用
不需要完整路径,只要它位于 PATH 上即可。
You can also use
No need for the full path as long as it's on the PATH.
使用内置的 start 命令。
Use the built-in start command.
你可以尝试使用
cmd /c X:\path_to\myprog.exe
You could try using
cmd /c X:\path_to\myprog.exe