Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Logon batch script trouble  (Read 7999 times)

0 Members and 1 Guest are viewing this topic.

Andy W

  • Guest
Logon batch script trouble
« on: August 11, 2004, 07:56:36 AM »
Hey all

I'm creating a logon script for a small network of about 30 PCs, some Windows 98SE, some XP Pro. The login script currently synchronises the computers clock with the server, and maps some standard network drives.

However, for certain usernames I want to map some extra drives. In the script I'm using the putinenv utility to get the username and then performing an if to check the username, like this:

Code: [Select]
\\Server\netlogon\putinenv L /l

if "%username%"=="testuser" goto mapextra


This works fine on the 98 machines as the putinenv utility returns the username in lower case - so my test works fine. However on the XP machines, the username environment variable is kept in the case that the user entered at the login screen, which could be TESTUSER, TestUser, TEstuSEr etc etc.

This causes the if to fail, as it is not an exact match - is there any way to ignore case in the if, or to force the XP username environment variable into small case? Or any other ways around this?

Thanks in advance

Andy W