How do I create a shortcut via command-line in Windows?

后端 未结 9 899
忘掉有多难
忘掉有多难 2020-11-28 04:17

I want my .bat script (test.bat) to create a shortcut to itself so that I can copy it to my windows 8 Startup folder.

I have written this line of code to copy the f

9条回答
  •  时光说笑
    2020-11-28 05:11

    Nirsoft's NirCMD can create shortcuts from a command line, too. (Along with a pile of other functions.) Free and available here:

    http://www.nirsoft.net/utils/nircmd.html

    Full instructions here: http://www.nirsoft.net/utils/nircmd2.html#using (Scroll down to the "shortcut" section.)

    Yes, using nircmd does mean you are using another 3rd-party .exe, but it can do some functions not in (most of) the above solutions (e.g., pick a icon # in a dll with multiple icons, assign a hot-key, and set the shortcut target to be minimized or maximized).

    Though it appears that the shortcutjs.bat solution above can do most of that, too, but you'll need to dig more to find how to properly assign those settings. Nircmd is probably simpler.

提交回复
热议问题