开发者

How to Change to current user's directory in a batch file

开发者 https://www.devze.com 2023-03-30 05:27 出处:网络
How is it possible to c开发者_StackOverflow中文版hange to a user default directory Is there a default variable that can be used e.g. %USER%

How is it possible to c开发者_StackOverflow中文版hange to a user default directory

Is there a default variable that can be used e.g. %USER%

would return: C:\Users\MyUsername


Use %UserProfile%.

cd /D %UserProfile%

/D : change the current DRIVE in addition to changing folder.


Use %HOMEPATH%.

So:

CD %HOMEPATH%
0

精彩评论

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