Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

how to handle & symbol in LaunchAppAndWait


2 replies to this topic

gmpk82

gmpk82
  • Full Members
  • 40 posts

Posted 07 January 2016 - 15:50

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
GMPK


deramor

deramor
  • Full Members
  • 187 posts

Posted 08 January 2016 - 19:43

This is just a guess but maybe if you look into using LAAW_OPTION_USE_SHELLEXECUTE

 

When you use this option, LaunchApplication will call ShellExecuteEx instead of calling CreateProcess, like it normally does.

 

You may see different behavior.



gmpk82

gmpk82
  • Full Members
  • 40 posts

Posted 11 January 2016 - 07:15

Thanks for your reply, I found a way 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
GMPK