I'm trying to run the Windows net.exe program to connect to a computer (escaping double quotes on the passwords):
NET USE \\computer /USER:domain\user "%password:"=""%"
But I notice this isn't working for a password starting with a slash ("/"), as it's taken as a keyword:
C:\> NET USE \\computer /USER:domain\user "/password"
The option /PASSWORD is unknown
The syntax of this command is:
...
Some sites suggest using redirection
echo asdf|net use \\comp /user:dom\user *
net use \\comp /user:dom\user *<password.txt
But these ways aren't working (anymore?), at least on my Windows 10 (version 10.0.19045.4529) machine, with NET
nor RUNAS
, not even using asdf
as password.
So, is there any way I can run NET USE if the password starts with a slash?
NET USE \\computer /user:dom\user "password1234"
is correct, it works, except when the password starts with a slash.