Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Possible Duplicate:
How to create a shortcut using a batch script?

I would like to create shortcut files from some commands on a batch file.

Currently, I create .bat files for such each shortcut, but I would like to create .lnk files instead.

Any ideas?

share|improve this question

marked as duplicate by Dennis, CharlieRB, Mokubai, Indrek, 8088 Aug 22 '12 at 20:15

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

You can either use a third-party program or create a temporary .vbs script. See the answers here: How to create a shortcut using a batch script? –  Dennis Aug 22 '12 at 19:25
Do you mean create shortcuts to execute command prompt commands, or create a shortcut from a command prompt command? Edit: Oh, forgot what your title said. Yeah, what Dennis said is the only way to do it. I ran into this exact problem a while back. –  SaintWacko Aug 22 '12 at 19:43

1 Answer 1

up vote 0 down vote accepted

For starters, never use %username% to get a user's profile path.

You should use the environment variable USERPROFILE instead of the username, because sometimes the user profile path contains more than just the username (e.g. ., .000, .windows)

Back to your issue:

You cannot create a shortcut by just copy the exe file.

You can use a VBScript to create the shortcut:



Some free command line tools for shortcut creation:

Marty List's shortcut.exe http://optimumx.com/download/#Shortcut



share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.