开发者

script to map networkdrive base on username

开发者 https://www.devze.com 2023-01-11 00:26 出处:网络
I have a .cmd script I want to map a network drive based on the username of the person running it.So something like this

I have a .cmd script I want to map a network drive based on the username of the person running it. So something like this

net use K: \\nas001\users\[My_User_Name]

Except replace [My_User_name] with t开发者_Go百科he name of the user running the script. Is this possible?


The environment variable %USERNAME% contains the actual user name, so you could use this, but I wouldn't advice this.

Windows has the concept op 'home drive', to which you can connect using:

NET USE K: /HOME

I think it's better to use that concept.

0

精彩评论

暂无评论...
验证码 换一张
取 消