I need to open files of type .unitypackage
using the command Unity.exe -openfile "%1"
, but if I "right-click -> open with" it only allows me to select the program, not the command line options.
What can I do to fix that on Windows 8.1?
Answer
There are a few different options to set a file association in Windows 8. Unfortunately, the built-in methods tend not to support any fancy like custom command-line arguments.
You can right-click a file and select Open With, then Choose Default Program to browse for the program. You will likely need to manually edit the registry to add the
-openfile
switch.You can set file associations with the Set Default Programs app; again you will need to manually modify the registry to include the switch.
If you go this route, then you can do it as follows:
- Select Settings
- Type
associate
- Select Change the file type associated with a file extension
- Select the file extension
- Click the
[Change Program]
button
Note, you may not see the file extension in the list if you have not previously tried to open the file (for example with the previous method).
Use a third-party program like FileTypesMan to create a file association. With FileTypesMan, you could do it as so:
- Edit → New File Extension (or Ctrl+T)
- Fill out the dialog to create an extension
.unitypackage
: - Actions → New Action (or Ctrl+N)
- Fill out the dialog:
Manually create the registry entries for the association. I’ve taken the liberty of whipping one up for you. Just copy it to a plain-text file, make sure to save it with an extension of
.reg
, not.reg.txt
(you can do this by selectingAll Files (*.*)
in the file-type drop-down in the Save As dialog). Then run the saved registry script and accept to merge it. You can use hard-coded paths (which you can edit if needed in the text-editor) or use variables by uncommenting the specified lines (you would need to edit those in Regedit since they are encoded as hexadecimal).REGEDIT4
[HKEY_CLASSES_ROOT\.unitypackage]
@="UnityPackage"
[HKEY_CLASSES_ROOT\UnityPackage]
@="Unity Package"
[HKEY_CLASSES_ROOT\UnityPackage\Shell\DefaultIcon]
@="\"C:\\Program Files (x86)\\Unity\\Editor\\Unity.exe\",1"
; Uncomment the line below by removing the leading semi-colon to use an environment variable ("%ProgramFiles(x86)%\Unity\Editor\Unity.exe",1) instead of the hard-coded path above.
;@=hex(2):22,25,50,72,6f,67,72,61,6d,46,69,6c,65,73,28,78,38,36,29,25,5c,55,6e,69,74,79,5c,45,64,69,74,6f,72,5c,55,6e,69,74,79,2e,65,78,65,22,2c,31,00
[HKEY_CLASSES_ROOT\UnityPackage\Shell\Open]
@="&Open"
[HKEY_CLASSES_ROOT\UnityPackage\Shell\Open\Command]
@="\"C:\\Program Files (x86)\\Unity\\Editor\\Unity.exe\" -openfile \"%1\""
; Uncomment the line below by removing the leading semi-colon to use an environment variable ("%ProgramFiles(x86)%\Unity\Editor\Unity.exe") instead of the hard-coded path above.
;@=hex(2):22,25,50,72,6f,67,72,61,6d,46,69,6c,65,73,28,78,38,36,29,25,5c,55,6e,69,74,79,5c,45,64,69,74,6f,72,5c,55,6e,69,74,79,2e,65,78,65,22,20,2d,6f,70,65,6e,66,69,6c,65,20,22,25,31,22,00
(Note: I do not have Unity installed on my current machine, so I cannot check the icons included in the binary, so you may need to change the ,1
in the DefaultIcon settings in the registry script and dialogs to something more appropriate like ,3
or ,10
or something, if it doesn’t include any document icons at all, then either use ,0
or remove that part altogether.)
No comments:
Post a Comment