Removing special characters in cmd

I have a Windows.bat script in which I try to run a command with a password in a parameter. The password I want to use is ~!@#$%^&*()_+|-=\][{}';:"/.>?,< .

From what I read here , I should avoid ^&|\<> c ^ . From what I am suggesting, I should avoid " using \" .

This gives me something like this:

 runme.exe /password:"~!@#$%^^^&*()_+^|-=^\][{}';:\"/.^>?,^<" 

But this will not work - my target application responds with a login error.

How can I avoid all these characters in order to be able to hardcode the password in my party (ignoring security issues at the moment)?

+9
cmd escaping
Apr 24 '12 at 10:29
source share
2 answers

Double quote in the password and make sure the full password is also enclosed in quotation marks:

 runme.exe /password:"~!@#$%%^^^&*()_+^|-=\][{}';:""/.>?,<" 
+10
Apr 24 '12 at 12:11
source share

Try it, but if runme.exe parser arguments require quotes as string encapsulators for passwords, this will not work. If you need a quote in your password, then runme.exe should provide a way to avoid this.

 runme.exe /password:~!@#$%%^^^&*()_+^|-=\][{}';:"/.>?,< 
+1
Apr 24 '12 at 10:59
source share



All Articles