Créer un raccourci en ligne de commande
Pour créer un racourci il est nécessaire d'avoir le programme shortcut.exe (infos) dans system32. Une fois le prérequis satisfait lancez en tant qu'administrateur une console DOS puis exécutez shortcut pour connaitre les options disponibles.
Shortcut [Version 1.11] Creates, modifies or queries Windows shell links (shortcuts) The syntax of this command is: shortcut /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.
exemple:
shortcut /F:"C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Schneider Electric\DriversManagerAdm.exe.lnk" /A:C /T:"C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Schneider Electric\DriversManagerAdm.exe" /R:1 /I:%APPDATA%\Microsoft\Installer\{4201BA84-EC1B-4B75-A1EF-E77D3E958465}\NewShortcut2_EF0DB3E49A034D2DB3C83354A180C3B3.exe,0
Dernière modification : le 2019/09/27