It’s not possible to create a traditional shortcut on your core server desktop. Instead, you can create .lnk files in the desktop location that you can call by typing the name of the lnk file that you have created.
It has limited use but let’s come up with an example. Say you wanted a shortcut to the time \ date options. You could type the following at the console:
But hey, wouldn’t it be much better to have a shortcut to this instead? Here’s how to do it via code:
1. At the console, type: notepad and copy the following code into it:
' Create the shell object. Set WshShell = WScript.CreateObject("WScript.Shell")
' Define the location of the LNK file. LinkFilename = WshShell.ExpandEnvironmentStrings("%USERPROFILE%") LinkFilename = LinkFilename + "\Desktop\td.LNK"
' Create the LNK file object. Set LNKFile = WshShell.CreateShortcut(LinkFilename)
' Set the LNK file contents. LNKFile.TargetPath = "%SYSTEMROOT%\System32\control.exe" LNKFile.Arguments = "timedate.cpl" LNKFile.Description = "Open TimeDate" LNKFile.HotKey = "" LNKFile.WindowStyle = "1" LNKFile.WorkingDirectory = "C:\"
' Save the LNK file to disk. LNKFile.Save
- In the above code, td.lnk is the name of our shortcut, which will be placed in the %USERPROFILE%\desktop. You can substitute the name of your shortcut and windows variable to suit your needs.
- LNKFile.TargetPath, .Arguments and .Description are self-explanatory and you’ll need to adjust these if you want your shortcut to do something other than open the Time\Date
If your shortcut does not contain any arguments then the line would read:
LNKFile.Arguments = ""
You don’t need to be a programmer to edit this code to meet your need – just a basic understanding of shortcuts.
2. When you’re done, save the script with a .vbs extension. In this example, I’ve saved it in C:\ and the script is called: timedate.vbs
3. Next, we need to execute the script. At the console, type the following:
4. Change to the desktop:
5. Run your newly created shortcut.
6. Here’s the results from our example:
7. You can use the dir command to see all of your ‘handy’ shortcuts.