开发者

console exe (made in C#) runs from cmd prompt but not from a batch file on Windows 7

开发者 https://www.devze.com 2023-02-05 11:51 出处:网络
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 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 ...


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:

C:\Program Files (x86)\Winamp\winamp.exe

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" is only used for running another batch file.

As shoban says, just use the name of the .exe


You can also use

myprog

No need for the full path as long as it's on the PATH.


Use the built-in start command.


You could try using cmd /c X:\path_to\myprog.exe

0

精彩评论

暂无评论...
验证码 换一张
取 消