Batch "Öffnen mit" Option in einer Batch Datei

Brabanter

Newbie
Registriert
Apr. 2011
Beiträge
3
Hallo,

meine Aufgabe lautet; per Batch Datei ein Programm installieren und am Ende eine Verknüpfung auf dem Desktop hinterlegen. Alles läuft prima bis auf die Verknüpfung die als farbloses Icon erscheint und separat durch "Öffnen mit" belegt werden muss. Gibt es eine Möglichkeit die "Öffnen mit" Option gleich in die Batch Datei einzubauen?

Danke für die Hilfe
 
Ich gebe dem Paket eine vorbereitete .lnk mit, die am Ende der Installation auf den Desktop kopiert wird:

copy /V /Y /Z host.lnk "%PUBLIC%\Desktop"

Ich möchte aber das dieser .lnk mit folgender .exe geöffnet wird:

%ProgramFiles(x86)%\IBM\Personal Communications\pcsws.exe
 
Alternativ: http://optimumx.com/downloads.html (runterscrollen bis Shortcut.exe erscheint). Das nutze ich immer in Batch-Files. Funktioniert tadellos.
Code:
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.


 Copyright 2000-2005 Marty List, www.OptimumX.com
 
Danke Yuuri!

Wow das ist ja eine Erleichterung, ich hätte es zwar lieber mit DOS Bordmitteln hingekriegt aber solange es funktioniert will ich mit dieser Lösung zufrieden sein.

Weil es so leicht und locker ging, weiß jemand ob es auch einen Kommandozeilen-Utility für das Arbeiten mit Umgebungsvariablen gibt? Das wäre meine nächste Baustelle.
 
Zum zwanzigsten Mal: Es gibt kein DOS mehr. Das ist die NT-Konsole.
 
Zurück
Oben