# Windows

## General discussion

Locked

### Environment variable..

By ·
I would like to map a home directory for users using logon scripts. However, I want to use the %username% variable. How can I set this variable to be equal to the username used during logon on a Windows9x box? Basically, I am just trying to map the users' home dir to ONLY their share. Right now everybody can see all the other users' directories and must browse to their own (since I used Usrmgr to map h: to \\servername\home\%username%).

Thanks,
Kurt

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

Collapse -

### Environment variable..

by In reply to Environment variable..

I tought you're already had the answer, from last time you posted it.
Since the first answer didn't work, I'll just follow up for the right answer.

Collapse -

### Environment variable..

by In reply to Environment variable..

Well Calves, I appreciate your help. But, your answer wasn't the answer to my question. I STILL can't seem to find a way to map ONLY to the user's home dir?????

Collapse -

### Environment variable..

by In reply to Environment variable..

You will have to map the drive in the user's logon script.
net use x: /home

Collapse -

### Environment variable..

by In reply to Environment variable..

I will try this, thanks..

Kurt

Collapse -

### Environment variable..

by In reply to Environment variable..

Try the SUBST (substitute command)
SUBST can subsitute a drive letter for the \\server\home\%username%
Example
When a user logs on, a script (UsrLogon.cmd) will be run that maps a drive letter to their home directory using the “subst”command. For example, Z will map to \\server\users\fredf for Fred Flounder and to \\server\users\barneyb for Barney Baitfish.

Collapse -

### Environment variable..

by In reply to Environment variable..

I guess I don't understand how using SUBST will help here? This is the second time I've gotten that answer. I'll have to look into this more... Thanks.

Collapse -

### Environment variable..

by In reply to Environment variable..

If you do not wish to let other users browse the other users' directories, perhaps you can hide them by putting the "\$" when you indicate you want to share this particular directory, so for eg, if you created a directory called Kurt, when you specify the share name, just put kurt\$. Then map your username to that hidden directory.

Collapse -

### Environment variable..

by In reply to Environment variable..

Well, how well could this work for 600 users though?

Collapse -

### Environment variable..

by In reply to Environment variable..

OK, so Win9x cannot interpret %USERNAME% so wherever you try to use it you get a null value. That is why it maps to \\servername\home. As a matter of security, if you are sharing out each user directory you should use the "\$" at the end of the share name but you won't be able to get Win9x to map directly there without a hardcoded script. For my few 9x machines I create c:\maphome.bat with net use h: \\servername\actualusername\$ in it. In the login script i use: "if exist c:\maphome.bat callc:\maphome.bat" I wouldn't want to use it for 100 PC's but it works for a few if the same user always uses the same PC.

Collapse -

### Environment variable..

by In reply to Environment variable..

Thanks, but I have lots of users....

• 48

• 25

• 18

• 4