문제

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 the 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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top