How do I pass the password to a net use command which contains % at the end?
--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game Looping
--
Chapters
00:00 How Do I Pass The Password To A Net Use Command Which Contains % At The End?
00:38 Accepted Answer Score 22
00:59 Thank you
--
Full question
https://superuser.com/questions/1765625/...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#windows #cmdexe
#avk47
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game Looping
--
Chapters
00:00 How Do I Pass The Password To A Net Use Command Which Contains % At The End?
00:38 Accepted Answer Score 22
00:59 Thank you
--
Full question
https://superuser.com/questions/1765625/...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#windows #cmdexe
#avk47
ACCEPTED ANSWER
Score 22
There are a few solutions to your problem
- Use a variable for the
password
set "password=b91A*9AIvPr%"
net use \\192.168.40.40 /user:192.168.40.40\Administrator %password%
- Use a special character escape sequence. Use a double percent symbol:
net use \\192.168.40.40 /user:192.168.40.40\Administrator b91A*9AIvPr%%
- Escape the quotations with
^
:
net use \\192.168.40.40 /user:192.168.40.40\Administrator ^"b91A*9AIvPr%^"