The next step creates a location
name based on the user??™s profile??”the
\Users\UserName
folder for the user. You may use any of the
environment variables that Windows supports to obtain information for your scripts. It then adds
the actual LNK file location to the path.
Now that the code has a path to use for creating the LNK file, it uses the
CreateShortcut()
function to create it. At this point, the script sets the various LNK file contents. Any field you can
change in a LNK file, you can also change using a script. Finally, the script saves the results to the
hard drive. It??™s essential to perform this final step or LNK file won??™t work. Simply type the LNK filename
and press Enter to execute it at the command line. For example, in this case you would type
Notepad.LNK
and press Enter at the command line to start a copy of Notepad. You??™ll find complete
coverage of scripts in Chapter 6.
44 CHAPTER 3
PERFORMING ESSENTIAL MAINTENANCE TASKS
TIP
You can find a downloadable version of the
Shortcut
command at
http://www.optimumx
.com/download/
. The
Shortcut
command provides the means to create a LNK file without
resorting to using a script.
Pages:
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171