M
murdo
Hi
I am trying to get the path of the Default user profile (usually
C:\Documents and Settings\Default User but not always) so I can make a
script work in all situations.
I have developed the following script to query the registry using the
reg.exe (available in the Win2000 resource kit for Win2000 and
installed as standard in XP)
FOR /F "tokens=2* delims= " %%A IN ('REG QUERY
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\ProfileList" /v ProfilesDirectory') DO SET
Defaultuser=%%B
ECHO Defaultuser=%Defaultuser%
FOR /F "tokens=2* delims= " %%A IN ('REG QUERY
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\ProfileList" /v DefaultUserProfile') DO SET
Defaultuserprofile=%Defaultuser%\%%B
ECHO Defaultuserprofile=%Defaultuserprofile%
The result of the Defaultuserprofile echo when this is run in a .bat
files is %systemdrive%\documents and settings\default user which if
you try to use creates a %systemdrive% directory in the root of C.
This is because the environment has already resolved the
$Defaultuserprofile% variable.
Can any one help me remove the internal environment varable in
$Defaultuserprofile% please. It is possible to echo it out but I
cannot get the result of the echo stored in an environment varibale.
Thanks
G
I am trying to get the path of the Default user profile (usually
C:\Documents and Settings\Default User but not always) so I can make a
script work in all situations.
I have developed the following script to query the registry using the
reg.exe (available in the Win2000 resource kit for Win2000 and
installed as standard in XP)
FOR /F "tokens=2* delims= " %%A IN ('REG QUERY
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\ProfileList" /v ProfilesDirectory') DO SET
Defaultuser=%%B
ECHO Defaultuser=%Defaultuser%
FOR /F "tokens=2* delims= " %%A IN ('REG QUERY
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\ProfileList" /v DefaultUserProfile') DO SET
Defaultuserprofile=%Defaultuser%\%%B
ECHO Defaultuserprofile=%Defaultuserprofile%
The result of the Defaultuserprofile echo when this is run in a .bat
files is %systemdrive%\documents and settings\default user which if
you try to use creates a %systemdrive% directory in the root of C.
This is because the environment has already resolved the
$Defaultuserprofile% variable.
Can any one help me remove the internal environment varable in
$Defaultuserprofile% please. It is possible to echo it out but I
cannot get the result of the echo stored in an environment varibale.
Thanks
G