This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- how to handle & symbol in LaunchAppAndWait
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 07, 2016
08:55 AM
how to handle & symbol in LaunchAppAndWait
hi folks,
I am executing a command using LaunchAppAndWait, in command line I am using password which is entred by the user. if the password contains "&" symbol e.g. Abcde&1234 command execution is failing, im getting the output as " operation Failed with user provided password
'1234' is not recognized as an internal or external command,"
my code is as follows, how to handle & symbol.
'I get the value of szLBPwd during installation
'szAppPath is executable binary path
szCmd = "";
szCmd = " -abcd -password " + szLBPwd + " abc -xyz > output.log 2>&1";
nRes = LaunchAppAndWait(svCmdPath ^ "cmd","/C " + szAppPath + szCmd, LAAW_OPTION_WAIT | LAAW_OPTION_HIDDEN);
nReturnCode = NULL;
nReturnCode = LAAW_PARAMETERS.nLaunchResult;
best regards
phanik
I am executing a command using LaunchAppAndWait, in command line I am using password which is entred by the user. if the password contains "&" symbol e.g. Abcde&1234 command execution is failing, im getting the output as " operation Failed with user provided password
'1234' is not recognized as an internal or external command,"
my code is as follows, how to handle & symbol.
'I get the value of szLBPwd during installation
'szAppPath is executable binary path
szCmd = "";
szCmd = " -abcd -password " + szLBPwd + " abc -xyz > output.log 2>&1";
nRes = LaunchAppAndWait(svCmdPath ^ "cmd","/C " + szAppPath + szCmd, LAAW_OPTION_WAIT | LAAW_OPTION_HIDDEN);
nReturnCode = NULL;
nReturnCode = LAAW_PARAMETERS.nLaunchResult;
best regards
phanik
(3) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 15, 2016
12:52 PM
phanik,
You need to quote the password string; but you need to escape the quotes using the 4 chars "\"" as shown below. Try changing this line to:
szCmd = " -abcd -password " + "\"" + szLBPwd + "\"" + " abc -xyz > output.log 2>&1";
You need to quote the password string; but you need to escape the quotes using the 4 chars "\"" as shown below. Try changing this line to:
szCmd = " -abcd -password " + "\"" + szLBPwd + "\"" + " abc -xyz > output.log 2>&1";
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 20, 2016
12:03 AM
thanks for your reply rguggisberg
I found a way before your reply and implemented but i am not sure it is right way to do it. If I find a & symbol in password i am adding ^ symbol by following below code. command execution is getting succeeded. Please let me is it right way.
if(svMyPwd % "&") then
StrReplace(svMyPwd, "&", "^&",0);
endif;
best regards
phanik
I found a way before your reply and implemented but i am not sure it is right way to do it. If I find a & symbol in password i am adding ^ symbol by following below code. command execution is getting succeeded. Please let me is it right way.
if(svMyPwd % "&") then
StrReplace(svMyPwd, "&", "^&",0);
endif;
best regards
phanik
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 20, 2016
06:11 AM
That will work for &. You will probably have trouble with other characters too. Like (^%"
Quoting would work for most, but not for "
You may want to test further and escape other chars as you have done for &.
Quoting would work for most, but not for "
You may want to test further and escape other chars as you have done for &.
![](/skins/images/A5EADE085F77DE82FB3B14D6B307AE6A/responsive_peak/images/icon_anonymous_message.png)