Jump to content

OptimumX shortcut.exe utility anyone?


Recommended Posts

shortcut.exe is a small utility developed by optimumX that can create shortcuts.

I have tried a billion combinations from cmd,exe (XP 32bit) and cant figure out the problem. Any suggestions welcome.

shortcut /t:"%USERPROFILE%\Start Menu\Programs\folder\file.lnk" /a:c /f:"%PROGRAMFILES%\program\file.exe" /w:"%PROGRAMFILES%\folder.exe"

System error 3 has occured

 

The developer suggested I try double quotes: (didn't work either).

shortcut /t:""%USERPROFILE%\Start Menu\Programs\folder\file.lnk"" /a:c /f:""%PROGRAMFILES%\program\file.exe"" /w:""%PROGRAMFILES%\folder.exe""

The parameter 'and' is invalid

 

The documentation:

Shortcut [Version 1.11]

Creates, modifies or queries Windows shell links (shortcuts)


The syntax of this command is:

Shortcut.exe /F:filename /A:C|E|Q [/T:target] [/P:parameters] [/W:workingdir]
         [/R:runstyle] [/I:icon,index] [/H:hotkey] [/D:description]

 /F:filename    : Specifies the .LNK shortcut file.
 /A:action      : Defines the action to take (C=Create, E=Edit or Q=Query).
 /T:target      : Defines the target path and file name the shortcut points to.
 /P:parameters  : Defines the command-line parameters to pass to the target.
 /W:working dir : Defines the working directory the target starts with.
 /R:run style   : Defines the window state (1=Normal, 3=Max, 7=Min).
 /I:icon,index  : Defines the icon and optional index (file.exe or file.exe,0).
 /H:hotkey      : Defines the hotkey, a numeric value of the keyboard shortcut.
 /D:description : Defines the description (or comment) for the shortcut.

 Notes:
 - Any argument that contains spaces must be enclosed in "double quotes".
 - If Query is specified (/A:Q), all arguments except /F: are ignored.
 - To find the numeric hotkey value, use Explorer to set a hotkey and then /A:Q
 - To prevent an environment variable from being expanded until the shortcut
   is launched, use the ^ carat escape character like this: ^%WINDIR^%

 Examples:
   /f:"%ALLUSERSPROFILE%\Start Menu\Programs\My App.lnk" /a:q
   /f:"%USERPROFILE%\Desktop\Notepad.lnk" /a:c /t:^%WINDIR^%\Notepad.exe /h:846
   /f:"%USERPROFILE%\Desktop\Notepad.lnk" /a:e /p:C:\Setup.log /r:3

 An argument of /? or -? displays this syntax and returns 1.
 A successful completion will return 0.


 Copyright 2000-2005 Marty List, www.OptimumX.com

 

Edited by shorterxp
Link to comment
Share on other sites


At first sight, /W: means "Working directory".

You are seemingly providing to the switch a file (executable BTW):

Quote

shortcut /t:"%USERPROFILE%\Start Menu\Programs\folder\file.lnk" /a:c /f:"%PROGRAMFILES%\program\file.exe" /w:"%PROGRAMFILES%\folder.exe"

And you may also try both with and without an ending backslash :unsure: (some tools consider as a path to a directory the full path to the directory name and some consider it if the name is followed by a backslash, and some will work with both notations).

The /F: means "shortcut .lnk Filename" (you are providing to it the target (executable) filename instead)

and /T: means "Target (executable) filename" (you are providing to it the shortcut filename instead)

Try:

shortcut /F:"%USERPROFILE%\Start Menu\Programs\folder\file.lnk" /A:C /T:"%PROGRAMFILES%\program\file.exe" /w:"%PROGRAMFILES%\folder"

jaclaz

 

Link to comment
Share on other sites

I misquote .exe on end of W for this forum post. Orignal did not have. I have tried your suggestion and triple checked the lines with/without trailing backslash and still nothing.

Whats weird is I use shortcut.exe for unattended install and it worked fine:

shortcut /a:c /f:"%allusersprofile%\start menu\programs\accessories\magnifier.lnk" /t:"%windir%\system32\magnify.exe" /w:"%windir%\system32"
shortcut /a:c /f:"%allusersprofile%\start menu\programs\accessories\on-screen keyboard.lnk" /t:"%windir%\system32\osk.exe" /w:"%windir%\system32"
shortcut /a:c /f:"%allusersprofile%\start menu\programs\dvd player.lnk" /t:"%windir%\system32\mplay32.exe" /w:"%windir%\system32"

The documentation suggests /a:c at middle, but I put it at front and it works okay. Either way, it doesn't like %programfiles%.

Edited by shorterxp
Link to comment
Share on other sites

Found the solution, the sub directory or 'program' folder needs to exist in start menu first. Shortcut.exe can not create directories.

 

so I use mkdir before I run shortcut.exe and it works.

Not obvious!

Edited by shorterxp
Link to comment
Share on other sites

  • 2 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...