Windows命令行:如何启动特定文件夹中的程序
Windows command line: how to start a program in a specific folder
我需要使用 "system" 命令为 C++ 程序启动一个程序(ChaosLauncher for StarCraft),但是 ChaosLauncher 需要从另一个目录启动:
我如何在 C++ 中做到这一点?
还是通过命令行?
我以前使用过 AutoIt 脚本,但当我更新到 Windows 10...
时它停止工作
除非我遗漏了什么,否则这应该相当简单。
运行 cmd.exe 作为管理员,使用
cd [your_directory]
将当前工作目录更改为您要从中启动程序的目录。接下来只需像以前一样启动程序(尽管您可能需要指定 .exe 的绝对路径)。
找到了!
system("start \"Chaos\" /D \"C:\Program Files (x86)\BWAPI\Chaoslauncher\\" \"C:\Program Files (x86)\BWAPI\Chaoslauncher\Chaoslauncher.exe\"");
使用"start"命令,/D指定程序启动的目录
我需要使用 "system" 命令为 C++ 程序启动一个程序(ChaosLauncher for StarCraft),但是 ChaosLauncher 需要从另一个目录启动:
我如何在 C++ 中做到这一点? 还是通过命令行?
我以前使用过 AutoIt 脚本,但当我更新到 Windows 10...
时它停止工作除非我遗漏了什么,否则这应该相当简单。 运行 cmd.exe 作为管理员,使用
cd [your_directory]
将当前工作目录更改为您要从中启动程序的目录。接下来只需像以前一样启动程序(尽管您可能需要指定 .exe 的绝对路径)。
找到了!
system("start \"Chaos\" /D \"C:\Program Files (x86)\BWAPI\Chaoslauncher\\" \"C:\Program Files (x86)\BWAPI\Chaoslauncher\Chaoslauncher.exe\"");
使用"start"命令,/D指定程序启动的目录