开始->运行->输入三个参数F:\123.exe F:\456.exe F:\789.exe执行F:\123.exe,123.exe是个console应用程序,需要输入三个参数,即上面三个参数才能正确执行123.exe。现在我想通过程序完成这一过程,说白了就是不用手工输入参数
目前我的工程名为test.exe在test中使用system("cmd.exe F:\123.exe 456.exe F:789.exe");得到的却是test.exe的路径 并没有执行后面的三个参数,请问这样做为什么不能实现?有什么比较号的方法?谢谢
目前我的工程名为test.exe在test中使用system("cmd.exe F:\123.exe 456.exe F:789.exe");得到的却是test.exe的路径 并没有执行后面的三个参数,请问这样做为什么不能实现?有什么比较号的方法?谢谢
{
system("cmd.exe F:\123.exe 456.exe F:789.exe");
}
ShellExecute(hWnd,"open","F:\123.exe","456.exe 789.exe",NULL,SW_SHOWNORMAL);
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_NO_UI;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = NULL;
ShExecInfo.lpFile = strBATFile;
ShExecInfo.lpParameters = "F:\123.exe 456.exe 789.exe"; //用空隔开,若参数带空格,参看msdn(\"\"\"space parameters\"\"\")
ShExecInfo.lpDirectory = NULL;
ShExecInfo.nShow = SW_SHOW;
ShExecInfo.hInstApp = NULL;
if(ShellExecuteEx(&ShExecInfo)){
//等待数据库备份完毕
WaitForSingleObject(ShExecInfo.hProcess,INFINITE);
}
strBATFile = "RmtDLL.exe";
SHELLEXECUTEINFO ShExecInfo = {0};
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_NO_UI;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = NULL;
ShExecInfo.lpFile = strBATFile;
ShExecInfo.lpParameters = "C:\WINNT\explorer.exe F:\TestTempProgramming\TestDLL\Debug\TestDLL.dll"; //用空隔开,若参数带空格,参看msdn(\"\"\"space parameters\"\"\")
ShExecInfo.lpDirectory = "F:\\TestTempProgramming\\RmtDLL\\Debug\\";
ShExecInfo.nShow = SW_SHOW;
ShExecInfo.hInstApp = NULL;
if(ShellExecuteEx(&ShExecInfo)){
//等待数据库备份完毕
WaitForSingleObject(ShExecInfo.hProcess,INFINITE);
}exeplorer.exe TestDLL.dll作为RmtDLL.exe的命令行参数根本就没备执行啊?还是我的程序写的有问题?请指教?