25-06-24 02:32 PM
Hi All,
while entering password through command prompt by bot encountered an issue like password is not recognized as an internal command
Please find the password that I'm using
Password: {T3|RJ7qkxcwH}l98biVdS[MY
after handling and escaping special characters
updated password: {{}T3|RJ7qkxcwH{}}l98biVdS[MY
Please assist me. Thanks in advance
Answered! Go to Answer.
26-06-24 07:26 AM
Hi @rokkam_saiteja ,
What you are trying to achieve would totally rely on Global Send Keys and with Global Send Keys the limitations are around special characters such as {, }, [,], ( or ) that you would always need to escape using parentheses '{}'. However, for pipe symbol, I don't believe there is any limitation. You can see from the below screenshot, when I tried using the same calculation formula which I provided in my prior thread, I am able to write into Notepad (which means Global Send Keys will support it no matter which application you use):
Now, coming to the part around stability, I always suggest avoiding UI based CMD automation whenever any case as such arises. Reason being, there are limitations when it comes to special characters and secondly the application must remain on a foreground state that can be impacted at any point in a LIVE staging platform. For your use case though, runas command has this security implication where it would always give out a popup window for entering password so there is unfortunately no way to bypass this screen even if we write a batch script which is always the best preferred way.
However, there is an utility by Microsoft itself called as PsExec. It basically includes launching interactive command-prompts on remote systems and remote-enabling tools which can actually help us to achieve the same results that we want via runas command.
You need to download the compressed zip utility from the link that I provided above and then extract the contents and save it in some preferred location (I would say C drive):
Now, you can simply go to Start menu and search for 'Environment Variables' and add this path to the PATH environment variable as shown below:
Please note this step you need to do in every machine where you intend to run this automation (Runtime Resources)
Now, you can simply run the utility with the same Start Process action with slightly different parameters. Here instead of runas you would use psexec:
Application: psexec
Arguments: -u <DOMAIN_NAME>\<USERNAME> -p <PASSWORD> <APPLICATION_PATH>
NOTE: Please provide spaces between each flags and parameters in the above expression.
In my example, I have opened up Chrome using the same:
This utility would ensure that you do not need to escape any special characters as you are not using Global Send Keys and moreover, since this is a Microsoft utility itself there should not be any security implications to have it run on your machines.
If this route does not work, then you would need to rely on Global Send Keys and the calculation expression that I provided earlier still should be able to help you out.
25-06-24 08:28 PM
Hi @rokkam_saiteja ,
It might be a bit difficult to understand exactly which CMD command you are trying to execute involving password that causes this error. Can you please tell us the whole command?
From a Send Global Keys Stroke perspective, you need to escape '{', '}' and '[' in your password text by enclosing these characters within '{}'. For this you can use a calculation stage and replace these characters with '{}' using the below expression:
Replace(Replace(Replace(Replace(Replace(Replace([TxtTextToWrite], "[","Start[End"), "]","Start]End"), "}","Start}End"),"{","Start{End"), "Start", "{"), "End", "}")
Considering, TxtTextToWrite is the data item which holds the password value, this calculation will ensure the characters got escaped properly.
26-06-24 05:59 AM
Thank you so much @devneetmohanty07
We are using Environment Utility (nologging) -Start Process where the input parametrs are as
Application - "runas"
[Application and Path]:
CMD /K net use Z: \\pccsfs06.proteccoating.com\shares\Robotic_Process_Automation /user:RPA_User_Protec {T3|RJ7qkxcwH}l98biVdS[MY
Command: CMD /K net use Z: " & [Protec Folder] & " /user:" & [UserName] & " " & [Password]
Note: We already handled the special characters which may come in password data item expect the Pipe Line Character "|" .
[Character] = "{" OR [Character] = "}" OR [Character] = "+" OR [Character] = "^" OR [Character] = "%" OR [Character] = "~" OR [Character] = "(" OR [Character] = ")" OR [Character] = "$" OR [Character] = "!" OR [Character] = "[" OR [Character] = "]"
just placing the character within the "{[Character]}"
From source of internet we tried Caret(^) to escape the pipe character still facing the same issue.
Previously its worked but when we get the password contains pipe character ("|") at that time facing issue
Is there any alternative way to stable the CMD while entering password contains such Characters
Actaul Password:{T3|RJ7qkxcwH}l98biVdS[MY
Updated Password:{{}T3|RJ7qkxcwH{}}l98biVdS{[}MY
We are using Global Send key events to enter the [Updated password] in CMD
Thanks. Please let me know what I can do to solve this issue.
26-06-24 07:26 AM
Hi @rokkam_saiteja ,
What you are trying to achieve would totally rely on Global Send Keys and with Global Send Keys the limitations are around special characters such as {, }, [,], ( or ) that you would always need to escape using parentheses '{}'. However, for pipe symbol, I don't believe there is any limitation. You can see from the below screenshot, when I tried using the same calculation formula which I provided in my prior thread, I am able to write into Notepad (which means Global Send Keys will support it no matter which application you use):
Now, coming to the part around stability, I always suggest avoiding UI based CMD automation whenever any case as such arises. Reason being, there are limitations when it comes to special characters and secondly the application must remain on a foreground state that can be impacted at any point in a LIVE staging platform. For your use case though, runas command has this security implication where it would always give out a popup window for entering password so there is unfortunately no way to bypass this screen even if we write a batch script which is always the best preferred way.
However, there is an utility by Microsoft itself called as PsExec. It basically includes launching interactive command-prompts on remote systems and remote-enabling tools which can actually help us to achieve the same results that we want via runas command.
You need to download the compressed zip utility from the link that I provided above and then extract the contents and save it in some preferred location (I would say C drive):
Now, you can simply go to Start menu and search for 'Environment Variables' and add this path to the PATH environment variable as shown below:
Please note this step you need to do in every machine where you intend to run this automation (Runtime Resources)
Now, you can simply run the utility with the same Start Process action with slightly different parameters. Here instead of runas you would use psexec:
Application: psexec
Arguments: -u <DOMAIN_NAME>\<USERNAME> -p <PASSWORD> <APPLICATION_PATH>
NOTE: Please provide spaces between each flags and parameters in the above expression.
In my example, I have opened up Chrome using the same:
This utility would ensure that you do not need to escape any special characters as you are not using Global Send Keys and moreover, since this is a Microsoft utility itself there should not be any security implications to have it run on your machines.
If this route does not work, then you would need to rely on Global Send Keys and the calculation expression that I provided earlier still should be able to help you out.
26-06-24 10:30 AM - edited 26-06-24 10:32 AM
Thank you so much for the valuable information you provided.
Sorry to say that we don't have any permissions to download the Microsoft utility to do so in the Client VM as access is restricted.
But I have tried the above-mentioned calculation expression but still the same issue
Update Password :{{}T3|RJ7qkxcwH{}}l98biVdS{[}MY
Using existing action is there any solution to overcome the issue.
Once again thanks.
26-06-24 12:40 PM - edited 26-06-24 12:45 PM
Hi @rokkam_saiteja ,
The updated password ({{}T3|RJ7qkxcwH{}}l98biVdS[MY) should work with Global Send Keys. I also tested the same on my CMD application and as you can see I am able to enter the password:
From your screenshot, I can see that it did not even enter the first few characters, which most likely can be an issue due to application not being activated properly before the Send Global Keys action started working.
Can you try to use a navigate stage to activate the application first using the Screen element which most likely has been spied in Win32 spying mode, then provide a delay of few seconds and then use this navigate stage with root application element to type into the text.
26-06-24 01:04 PM
Tried the same by activating the application and wait for the 10 sec ,then entering password
still same issue
26-06-24 04:34 PM
Hi @rokkam_saiteja ,
This is most likely because you are not enclosing the password within double quotes in your command:
When you evaluate the expression you should see the below line:
CMD /K net use Z: \\pccsfs06.proteccoating.com\shares\Robotic_Process_Automation /user:RPA_User_Protec "{T3|RJ7qkxcwH}l98biVdS[MY"
As you can see the password is enclosed with double quotes. You need to also have this double quote character in your final string.
You can see I got the same error when I tried it the first time without double quotes and the next time error was expected as I do not have this network path but the command was correct:
27-06-24 12:15 PM
I have enclosed the update password within double quotes and tested the same but while inputting password cmd getting closed automatically.