Q

Can the variables %homepath% and %username%. be used in a login script file?

I have read all about the environmental variables such as %homepath% and %username%. Can either of these variables be used in a login script (.bat) file? I have tried every possible combination. If it can be done, what is the syntax? The profiles tab in the ADS for users has the homepath as serverdiruser. Obviously I am trying to map a drive letter to serverdiruser, where each user is unique.
It all depends on what user context the batch file runs in. If the batch file is kicked off in the LOCAL_SYSTEM account, those environment variables won't be defined. However, if the batch file is started from the user's account, simply specify them like SERVER%USERNAME%.
This was first published in March 2002

Dig deeper on Windows Operating System Management

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchServerVirtualization

SearchCloudComputing

SearchExchange

SearchSQLServer

SearchWinIT

SearchEnterpriseDesktop

SearchVirtualDesktop

Close