Link to home
Start Free TrialLog in
Avatar of ChrisWible
ChrisWibleFlag for United States of America

asked on

Running a .bat file that exectutes a program and passes it a password that has an exclamation point

HI,

I need help figuring out how to pass a password with an exclamation point to a program from inside a batch file.  I have tried multiple methods.  Like using SETLOCAL EnableDelayedExpansion before the line that executes the program passing it the password.

Neither of these works:

This alone:

deployssrsreports.exe "Doesn!tWork"

And also this:

SETLOCAL EnableDelayedExpansion
deployssrsreports.exe "Doesn!tWork"

When logged, with an echo, the password has no exclamation point.
Avatar of NVIT
NVIT
Flag of United States of America image

Can you change the password? How about passing 2 !!
Avatar of ChrisWible

ASKER

I can't change the password.  I really want my scripts to not care what the password is.  Thanks for the response, though.
ASKER CERTIFIED SOLUTION
Avatar of Qlemo
Qlemo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You can do something like this with ^ to escape the ! as long as it is in quotes.

echo "^!DDLS"

i.e.

SETLOCAL EnableDelayedExpansion
deployssrsreports.exe "Doesn^!tWork"

Open in new window


[Edit: Sorry Qlemo, duplicated your comment there, doing other things at the same time]
With EnableDelayedExpansion, you can send it with:

^^!

Regards, Joe
Excellent!  I am toooo overworked!  I should have seen this!  Thank you so much!!!