What's the problem?

Here is a simple example: In an installation script for the 32-bit version of Office 2010, an icon is created
for Microsoft Word on the common desktop. If all computers receiving the installation script are Windows XP,
it could look like this:
CreateShortCut C:\Documents and
Settings\All Users\Desktop, Word, _
C:\Program Files\Microsoft
Office\Office14\WinWord.Exe
This makes perfect sense from a certain (limited) point of view. If all computers on the network are installed
in the same way and all are running the same version of Windows, it might work, but probably not in the longer
run, because a number of things can "break" the script. It will not work, for example, once machines with OS's
newer than Windows XP are added, because the "common desktop" is in a completely different location on such machines.
Even with the same version of Windows, there can be a problem: If the company installs localized versions of
Windows XP, both the common desktop directory and the program files directory will have different names.
And if a 64-bit version of any version of Windows executes the script, the 32-bit program files directory will
have a different name again.
It might not be the biggest problem in the world that the shortcut can't be created, but if it is the norm to
hard-code paths, each and every script will eventually fail, as the clients in the network are upgraded or
different versions get installed. So the solution is to simply use FSH's built-in functions to replace logical paths.
Consider this rewrite of the same script line:
CreateShortCut [DesktopDir], Word, [ProgramFilesDirx86]\Microsoft
Office\Office14\WinWord.Exe
This will work on any current or future version of Windows, because nothing is hard-coded. When you use these
built-in functions, FastTrack will simply ask the operating system behind the scenes what the actual path is and
use that in the executing context.
To the right, there is a partial screen-dump of the Engine Browser in the editor. Make it a habit to always
use the functions under "Directory Paths", when you need to use any logical path.
Also please consider the table in the section below. Observe how different the same logical paths are on two
of the most common versions of Windows. There is no reason to believe that things will get simpler in future
versions, so do make it a habit to use these functions, thus eliminating the need
to edit the same scripts over and over as your network clients change.
As a final tip, you can get an overview of the output of these functions on any machine in your network,
by executing one of the example scripts. In the script editor, go to the "Documentation" tab and select
"Show Logical Paths" under the "Insert Example Script" submenu and execute it on any computer, to see what
all the logical paths are on that computer.
Comparison of default logical paths
The table below shows default paths on a Windows 7 64-bit computer and a Windows XP 32-bit computer
with the same user "Test User" logged on.
AppDataDir | C:\ProgramData | C:\Documents and Settings\All Users\Application Data |
CommonFilesDir | C:\Program Files\Common Files | C:\Program Files\Common Files |
CommonFilesDirx86 | C:\Program Files (x86)\Common Files | C:\Program Files\Common Files |
DesktopDir | C:\Users\Public\Desktop | C:\Documents and Settings\All Users\Desktop |
DocumentsDir | C:\Users\Public\Documents | C:\Documents and Settings\All Users\Documents |
FavoritesDir | C:\Users\Test User\Favorites | C:\Documents and Settings\All Users\Favorites |
FontsDir | C:\Windows\Fonts | C:\WINDOWS\Fonts |
ProfilesDir | C:\Users | C:\Documents and Settings |
ProgramFilesDir | C:\Program Files | C:\Program Files |
ProgramFilesDirx86 | C:\Program Files (x86) | C:\Program Files |
ProgramsDir | C:\ProgramData\Microsoft\Windows\Start Menu\Programs | C:\Documents and Settings\All Users\Start Menu\Programs |
StartMenuDir | C:\ProgramData\Microsoft\Windows\Start Menu | C:\Documents and Settings\All Users\Start Menu |
StartUpDir | C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup | C:\Documents and Settings\All Users\Start Menu\Programs\Startup |
SystemDir | C:\Windows\system32 | C:\WINDOWS\system32 |
SystemDirx86 | C:\Windows\SysWOW64 | C:\WINDOWS\system32 |
TempDir | C:\Users\Test User\AppData\Local\Temp | C:\Documents and Settings\Test User\Local Settings\Temp |
TempFile | C:\Users\Test User\AppData\Local\Temp\tmpD16.tmp | C:\Documents and Settings\Test User\Local Settings\Temp\tmpD.tmp |
TemplateDir | C:\ProgramData\Microsoft\Windows\Templates | C:\Documents and Settings\All Users\Templates |
UserAppDataDir | C:\Users\Test User\AppData\Local | C:\Documents and Settings\Test User\Local Settings\Application Data |
UserCookiesDir | C:\Users\Test User\AppData\Roaming\Microsoft\Windows\Cookies | C:\Documents and Settings\Test User\Cookies |
UserDesktopDir | C:\Users\Test User\Desktop | C:\Documents and Settings\Test User\Desktop |
UserDocumentsDir | C:\Users\Test User\Documents | C:\Documents and Settings\Test User\My Documents |
UserFavoritesDir | C:\Users\Test User\Favorites | C:\Documents and Settings\Test User\Favorites |
UserHistoryDir | C:\Users\Test User\AppData\Local\Microsoft\Windows\History | C:\Documents and Settings\Test User\Local Settings\History |
UserInternetCacheDir | C:\Users\Test User\AppData\Local\Microsoft\Windows\Temporary Internet Files | C:\Documents and Settings\Test User\Local Settings\Temporary Internet Files |
UserPersonalDir | C:\Users\Test User\Documents | C:\Documents and Settings\Test User\My Documents |
UserProfileDir | C:\Users\Test User | C:\Documents and Settings\Test User |
UserProgramsDir | C:\Users\Test User\AppData\Roaming\Microsoft\Windows\Start Menu\Programs | C:\Documents and Settings\Test User\Start Menu\Programs |
UserRecentDir | C:\Users\Test User\AppData\Roaming\Microsoft\Windows\Recent | C:\Documents and Settings\Test User\Recent |
UserRoamingAppDataDir | C:\Users\Test User\AppData\Roaming | C:\Documents and Settings\Test User\Application Data |
UserSendToDir | C:\Users\Test User\AppData\Roaming\Microsoft\Windows\SendTo | C:\Documents and Settings\Test User\SendTo |
UserStartMenuDir | C:\Users\Test User\AppData\Roaming\Microsoft\Windows\Start Menu | C:\Documents and Settings\Test User\Start Menu |
UserStartUpDir | C:\Users\Test User\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup | C:\Documents and Settings\Test User\Start Menu\Programs\Startup |
UserTemplateDir | C:\Users\Test User\AppData\Roaming\Microsoft\Windows\Templates | C:\Documents and Settings\Test User\Templates |
WinDir | C:\Windows | C:\WINDOWS |