Comment associer des extensions de fichier à des logiciels grâce à wpkg ?
Exemple des extensions .g2w et .g3w avec Geoplan et Geospace (merci à O. Lacroix), à adapter à votre cas :Je me suis créé ça pour installer geoplan sur L:\ro\geoplan et déployer les associations de fichiers sur tout mon établissement via wpkg.... Le raccourci est bien évidemment placé dans le template base...
J'ai créé un fichier Y:\unattended\install\packages\associations\associations.bat. Je le lance par wpkg sur toutes les machines avec le fichier associations.xml rajouté dans l'interface...
Les fichiers suivent...
Fichier associations.xml: <?xml version="1.0" encoding="UTF8"?>
<packages>
<package id="Associations_fichiers" name="Associations des fichiers avec les programmes de L:" reboot="false" priority="100" revision="1" notify="false" execute="once">
<check type="registry" condition="exists" path="HKEY_CLASSES_ROOT\g2w_auto_file"/>
<install cmd='%ComSpec% /c %Z%\packages\windows\associations_fichiers.bat'/>
<upgrade cmd='%ComSpec% /c %Z%\packages\windows\associations_fichiers.bat'/>
<remove cmd='%ComSpec% /c %Z%\packages\windows\associations_fichiers.bat UnInstall'/>
</package>
</packages>
Fichier associations.bat : @echo off
rem Fichier créant toutes les associations des logiciels présents sur L:\ro et rw et donc non installés localement...
If "%1"=="UnInstall" Goto UnInstall
echo Association des fichiers geoplan
reg.exe add "hkcr\.g2w" /ve /d g2w_auto_file /f
reg.exe add "hkcr\g2w_auto_file" /ve /d "Fichier Geoplan" /f
reg.exe add "hkcr\g2w_auto_file\shell\open\command" /ve /d "\"L:\ro\geoplan_geospace\GeoplanGeospace.exe\" \"%%1\"" /f
reg.exe add "hkcr\g2w_auto_file\DefaultIcon" /ve /d "\"L:\ro\geoplan_geospace\GeoplanGeospace.exe\"" /f
echo Association des fichiers geospace
reg.exe add "hkcr\.g3w" /ve /d g3w_auto_file /f
reg.exe add "hkcr\g3w_auto_file" /ve /d "Fichier Geospace" /f
reg.exe add "hkcr\g3w_auto_file\shell\open\command" /ve /d "\"L:\ro\geoplan_geospace\GeoplanGeospace.exe\" \"%%1\"" /f
reg.exe add "hkcr\g3w_auto_file\DefaultIcon" /ve /d "\"L:\ro\geoplan_geospace\GeoplanGeospace.exe\"" /f
Goto Done
:UnInstall
echo Suppression : Association des fichiers geoplan
reg.exe delete "hkcr\.g2w" /f
reg.exe delete "hkcr\g2w_auto_file" /f
echo Suppression : Association des fichiers geospace
reg.exe delete "hkcr\.g3w" /f
reg.exe delete "hkcr\g3w_auto_file" /f
one