Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 was marked as an exact duplicate of an existing 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
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:!msg/microsoft.public.scripting.vbscript/-RgWWk62aAE/qQ_u5sg8zOgJ


Some free command line tools for shortcut creation:

Marty List's shortcut.exe


share|improve this answer

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