I'm trying to run First.bat
file through java code but I'm getting error(Warning) popup that says
Windows cannot find First.bat. Make sure you typed the name correctly, and then try again.
Can anyone tell me what kind of error is it and where do I exactly place .bat
file to excute?
Process batRun = Runtime.getRuntime().exec("cmd /c start First.bat");
You are executing cmd
through java and default location where cmd starts is C:\\Users\\Username>
. Put First.bat
in C:\\Users\\Username
or provide absolute path to your First.bat
like D:\\\\MyFolder\\\\First.bat
Process batRun = Runtime.getRuntime().exec("cmd /c D:\\MyFolder\\First.bat");
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.