Skip navigation

JSI Tip 3419. How can a logon script identify the location of the All Users profile folder for Windows NT and Windows 2000 clients?

If you look at the environment variables, by opening a CMD prompt and typing set, you can see that there is no standard way to identify the All Users profile folder on both operating systems.

Both operating systems properly define the OS environment variable as Windows_NT.

You could use:

if exist "%ALLUSERSPROFILE%" goto Win_2000
REM Windows NT
set ALLUSERSPROFILE="C:\WinNT\Profiles\All Users"

but this method only works if the All Users profile is in a standard location.

Using REG from tip 0170, you can add the following four lines to your logon script:

set rp="\machine\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\common startup"
for /f "tokens=1*" %%i in ('%logonserver%\netlogon\reg -lv %rp%') do set RegValue=%%j
for /f "Tokens=*" %%k in ('@echo %RegValue%') do set AllUser=%%k
set AllUser=%AllUser:\Start Menu\Programs\Startup=%

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.