Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Acessing User Folders via Batch File

Status
Not open for further replies.

SHardy

Programmer
May 9, 2001
231
GB
Hi,

We have recently migrated from NT domain to Active Directory. At the same time everyone's network user IDs have changed.

For example:
- my old login = SHardy
- my new login = BRO_SHA

Now, windows appears to have remembered the association of my old ID. So (for example) instead of local settings being saved as follows:

C:\Documents and Settings\bro_sha\

they are still being saved to:

C:\Documents and Settings\Shardy\

Now the real issue is that I have written a small batch file to update certain user files. However, where I have used the %username% variable in the batch file, it is substituting this with the new ID and hence not finding the appropriate folders/ files.

How can I ensure that I am pointing to the correct path for all users?


Thanks,
Simon
 
It's OK. I have it now.

%USERPROFILE% returns (for me) "C:\Documents and Settings\Shardy".

I will now simply incorporate this into my script.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top