Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Passing parameter into batch file, and the parameter is a variable that holds a filepath
I'm calling a batch file from my qt program and am passing parameters. The batch file is set up correctly, I've pasted the code at the bottom. Below I have the section of my qt program that is the issue. The second parameter that I am passing is a variable of a filepath "sh3InstallLocation". But I am unable to pass it in. I get error with the batch. but if I change the value of sh3InstallLocation to something like "words" then everything works. Not sure what the issue is.
sh3InstallLocation = ui->lineEdit_SH3Install->text();
abc << "/K" << "C:\Documents and Settings\Shirin\My Documents\Dropbox\SH3 Files\SH3DC Installer\SH3DC_Installer\1.bat" << sh3InstallLocation;
echo money: !money!
echo nomoney: !nomoney!
echo moremoney: !moremoney!
Why do you replace \ with \? If the lineedit contains text "c:\whatever" you don't need to escape it to pass it to cmd.
[quote author="Chris Kawa" date="1388917768"]Why do you replace \ with \? If the lineedit contains text "c:\whatever" you don't need to escape it to pass it to cmd.[/quote]
This has nothing to do with my issue.
Well I don't have a magic 8-ball you know ;) You haven't really said what the issue is so I tried to best guess it.
What do you mean by " I am unable to pass it in. I get error with the batch."
You just did pass it in so you are able to. What kind of error do you get? How do you get it? Is it a runtime error, a message on the standard error stream or just a different output from what you expect?
An answer can only be as good as the question is.
How should I send the parameter to the batch file with spaces in my file path, that I'm sending as a parameter?