View Full Version : problem with passing string inside string argument
kk250040
01-22-2009, 07:38 AM
Hi Friends,
The command i want to send to the command prompt in File.Run action is /q:a /c:"install /q"
Note that this has a string inside the set of the command switches
I have done the following to run the exe and i want the above command prompt switches to be given for the exe to run
retStat=File.Run("", SessionVar.Expand("%TEMPexe%").."\\dotnetfx.exe", "/q:a /c:\"install /q\"", SW_MINIMIZE, true);
can anyone help on this. The above syntax gives me errors prompting for wrong switches.
ThankYou in advance
jassing
01-22-2009, 08:16 AM
This is well covered in the help file; as well as several posts in the forums....
You need to "escape" the quote
c = "My name is \"Josh\"";
this results in a variable 'c' that contains
My Name is "Josh"
kk250040
01-22-2009, 10:37 AM
Hi Jassing,
I did the same... I used the escape-sequence \" for inserting those switches into the arguments.
I tried two syntax for that to be done.
One being
retStat=File.Run("", SessionVar.Expand("%TEMPexe%").."\\dotnetfx.exe", "/q:a /c:\"install /q\"", SW_MINIMIZE, true);
and the other being
retStat=File.Run("", SessionVar.Expand("%TEMPexe%").."\\dotnetfx.exe", "/q:a /c:".."\"".."install /q".."\"".."", SW_MINIMIZE, true);
Please correct me if you find anything wrong, the exe runs correctly when i use the command switches at the command prompt, but somehow the switches prompt to be wrong when i use them from the sf7 scripts, can u tell me wat i can do for this. I am done with the task through a batch file though, but any comments how i can do this thru sf7 scripts?
ThankYou in advance
csd214
01-30-2009, 08:54 AM
I am a bit “out-dated”, but I think you should check your File.Run syntax. It seems you are passing your arguments as the WorkingFolder string. If you are unsure about the result of your string, I recommend to temporarily using a dialog message box or the SetupData.WriteToLogFile action:
sArgs = "/q:a /c:\"install /q\""
Dialog.Message("Notice 1", sFile.." - "..sArgs, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
Another tip: To make the code line more readable, you may use a combination of single and double quotes:
sArgs = '/q:a /c:"install /q"'
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.