我正在尝试使用 Java 函数Runetime.exec(String)
在 Windows 7 计算机的启动文件夹中运行程序,如下所示:
Runtime.getRuntime().exec(runner.getPath() + "\\run.bat");
当我运行它时,我收到一条错误消息,指出无法运行该命令:
Exception in thread "main" java.io.IOException: Cannot run program ""C:\Users\ly
ndsey\AppData\Roaming\Microsoft\Windows\Start": CreateProcess error=2, The syste
m cannot find the file specified
如您所见,当文件名应继续为“\Windows\Startup\run.bat”时,文件名在“\Windows\Start”处被截断。我可以使用其他替代方法吗?