Prev | Current Page 158 | Next

John Paul Mueller

"Administering Windows Server 2008 Server Core"


TIP
Server Core may not display links on the Desktop. In this case, you can still place links in a
common folder, such as
%USERPROFILE%
, which points to your user folder. You can still type the
LNK filename and press Enter to use the link file from the command line. In short, LNK files are
still useful, even if you can??™t see their physical manifestation in the form of an icon.
Listing 3.1:
Creating a New LNK File
' Create the shell object.
Set WshShell = WScript.CreateObject("WScript.Shell")
' Define the location of the LNK file.
LinkFilename = WshShell.ExpandEnvironmentStrings("%USERPROFILE%")
LinkFilename = LinkFilename + "\Desktop\Notepad.LNK"
' Create the LNK file object.
Set LNKFile = WshShell.CreateShortcut(LinkFilename)
' Set the LNK file contents.
LNKFile.TargetPath = "%SYSTEMROOT%\System32\Notepad.EXE"
LNKFile.Arguments = ""
LNKFile.Description = "Open Notepad"
LNKFile.HotKey = ""
LNKFile.IconLocation = "%SYSTEMROOT%\System32\Notepad.EXE, 1"
LNKFile.WindowStyle = "1"
LNKFile.WorkingDirectory = "C:\"
' Save the LNK file to disk.
LNKFile.Save
The code begins by creating a Windows Script shell. This shell provides access to features such
as environment strings and the function for creating a shortcut.


Pages:
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
PokerStars Betway Poker Puby poker online gdyz