Although we will switch ASAP from Windows XP to Windows 7, we still have a lot of clients running XP and I think it will takes us up to two years to finally switch the last machine.
One of the problems in the automatic jobs we are using is that Windows 7 has new paths for both the shared desktop and the shared start menu.
As an easy solution for this, we are now using this batch script. It will save the correct path to the two variables DESKTOP_FOLDER and STARTMENU_FOLDER and the real job simply uses them. That way, the scripts works on either XP or Win7.
I know there is a symbolic link “Startmenu” inside \ProgramData in Win7 but some programs refuse to with the link. That’s why I’m using the “real” path here.
IF "%PUBLIC%"=="" GOTO NO_PUBLIC
GOTO PUBLIC_FOUND
:NO_PUBLIC
Rem PUBLIC env var not here, assuming XP
SET DESKTOP_FOLDER=%ALLUSERSPROFILE%\Desktop
SET STARTMENU_FOLDER=%ALLUSERSPROFILE%\Startmenu
GOTO EXEC
:PUBLIC_FOUND
Rem Public Variable found
SET DESKTOP_FOLDER=%PUBLIC%\Desktop
SET STARTMENU_FOLDER=%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu
GOTO EXEC
:EXEC
echo EXEC!
echo Desktop folder is %DESKTOP_FOLDER%
echo Start menu folder is %STARTMENU_FOLDER%
No comments:
Post a Comment