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 last published in March 2002

Dig Deeper on Windows Operating System Management

PRO+

Content

Find more PRO+ content and other member only offers, here.

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.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchServerVirtualization

SearchCloudComputing

SearchExchange

SearchSQLServer

SearchWinIT

SearchEnterpriseDesktop

SearchVirtualDesktop

Close