Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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

From what I've read here, I should escape ^&|<> with ^. From what I assume, I should escape " with ".

This gives me something like that:

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

But it doesn't work - my target app responds with logon failure.

How should I escape all these characters to be able to hardcode the password in my batch (ignoring the security issues by now)?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
474 views
Welcome To Ask or Share your Answers For Others

1 Answer

Double the quote in the password and make sure the complete password is enclosed in quotes as well:

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...