views:

24

answers:

2

I'd like to create some sort of script that will create a particular shortcut on the desktop of any Windows computer. The idea is to make the script available (to students in a course) so that they can download it to their computer and run it just by clicking it (i.e. not running it at the command-line). The script will have to check for some particular folders and files, and, if they exist, create the shortcut.

I'm a Linux guy and know very little about Windows, and so I am not even sure where to start to looking. I considered into using a Python script to do this, but that apparently requires installing some Windows-specific extensions, which I don't want to insist that that users do.

+1  A: 

This can be done in VBScript, using the Windows Script Host which should be installed and usable on nearly any recent enough copy of Windows.

You want the CreateShortcut() method of the WshShell object which gets you an object representing a shortcut. You'd modify its properties and use its Save() method to actually create the shortcut file.

I've linked to the scripting guide at MSTN, as well as a page specific to the shell object. That should be a good starting point.

RBerteig
A: 

For this, I often work up a quick NSIS script and compile it to an EXE. The result is a very small executable. You can download NSIS itself at http://nsis.sourceforge.net/Download. I recommend HM NIS Edit to start with, as it has a wizard that builds a base script for you. Most of that wizard won't be applicable to your situation, but it is a good way to get started. Notepad++ also does syntax highlighting for NSIS.

Brad
InnoSetup would also work, on the same principle. And also free.
RBerteig