Executing commands in cmd.exe using QProcess
-
wrote on 28 May 2014, 04:01 last edited by
Hello,
I was trying to do this:
@
Process->start("cmd.exe",QStringList()<<"C:/Users/Admin/Desktop/test.txt");
@To check if the command works but it doesn't , it shows "" in the app output.
test.txt is in the desktop and I want to open it.
-
@
Process->start("cmd.exe /C start C:/Users/Admin/Desktop/test.txt");@
-
wrote on 28 May 2014, 06:23 last edited by
Hi,
try
Process->start("C:/windows/system32/cmd.exe",QStringList()<<"/C"<<"C:/Users/admin/Desktop/test.txt");
or wherever your win resides -
wrote on 28 May 2014, 06:37 last edited by
Thank you guys , both works fine , but why /C ? I don't use command line much but I don't think it's a command right ?
-
It executes the commands that follow as a script. Without it, cmd.exe would be opened and wait for input from keyboard.
1/5