views:

293

answers:

3

I would like to know if there is a DOS-Command in WinXP to create shortcuts (to an executable). I'm looking for DOS-Command if it is available, not a batch or script file (I'm only finding batch files and vbscipts when I search online).

Just to give you a background on what i'm doing, I would like Visual Studio 2005 to create a shortcut to the executable as part of the post-build event, and I was hoping to use a DOS-Command to do that.

Any help would be greatly appreciated. Thanks!

+1  A: 

batch files are files with DOS commands. If you're looking for DOS commands (and it takes more than a single step), then batch files are what you want.

If you want to use it in your post-build event, then a batch file will work just fine. Just type it in and it will work as if it were a DOS command.

Gabriel McAdams
Ok, so if I understand you correctly, creating a shortcut, cannot be accomplished in a single command? (I.e.: createshortcut "source.exe" "linkname.lnk")
JB_SO
it can work exactly like that if your batch file is called createshortcut
Gabriel McAdams
Hmmm..ok, so it has to be a batch or vbscript file then..Right now i'm using the post-build event to execute a command like the example below to copy and I was hoping that I could add another one-liner that would create a shortcut without having to add extra file(s).Example of a post-build script VS2005:xcopy "$(ProjectDir)exectable.exe" "$(TargetDir)"
JB_SO
You can do exactly that. find a batch file that takes parameters (any batch file that makes a shortcut will), and add - yourbatchfile.bat "$(ProjectDir)executable.exe" "(TargetDir)$(Assembly)" (I'mnot sure of the variable for the assembly)
Gabriel McAdams
A: 

You can specify a batch file and vbscript file as the command, and windows will just run the interpreter to execute your command as though it were a "DOS command"

Its not actually "DOS" anymore, it only looks like it.

Matthias Wandel
+1  A: 

There is a command line shortcut tool which can create .lnk shortcut files that comes with (the very old) Microsoft Windows NT 4.0 Resource Kit Support Tools.
http://www.microsoft.com/downloads/details.aspx?FamilyID=3E972E9A-E08A-49A2-9D3A-C0519479E85A&displaylang=en

Here is a reference for the shortcut tool itself:
http://ss64.com/nt/shortcut.html

However, if you are doing this as part of an installation, you should probably look into using a standard installer which can create these shortcuts an a fashion that is easily uninstalled as well. Try this question as a start:

http://stackoverflow.com/questions/112941/create-program-installer-in-visual-studio-2005

Ben Gartner