1

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?

kokbira
  • 5,429

1 Answers1

1

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:

https://groups.google.com/forum/?hl=en&fromgroups=#!msg/microsoft.public.scripting.vbscript/-RgWWk62aAE/qQ_u5sg8zOgJ

Alternatively:

Some free command line tools for shortcut creation:

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

MakeScut

http://www.scriptlogic.com/products/scriptingtoolkit/Default.asp

168335
  • 324
  • 1
  • 5
  • 12