We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

Kagurame
Posts: 3
Joined: Thu Oct 11, 2012 1:55 pm

Register a file association via command line

Hello there,

i´m in education for software developing and have to write some actions for our projects.

Now we need to register file associations (open file type *.xyz with this software abc, e.g. *.html with internet explorer or other).
We´re working with commands (command line) such as AddFile, NewShortcut etc.

I´ve looked in the documentation for commands, but no result :/
So i think i can implement this with an NewReg command, but i don´t know how to do this.

How does a command for this look like?
(To add an registry entry for open my filetype with my software automatically)

(I´m searching for the command byself, not a how to for add commands or something like this ^^)

Thanks for help (and sorry for my bad english, i´m from germany...),

Kagurame

Edit

I´ve created an associastion via regedit.exe at my computer (some test filetype to start a little test application which print out the given filename)

Now i´ve created the following command:

Code: Select all

NewReg -RegKey HKEY_CLASSES_ROOT\.aatga\* -Data aatga_auto_file
NewReg -RegKey HKEY_CLASSES_ROOT\aatga_auto_file\shell\open\command -Data "C:\Users\Kagurame\Desktop\Test\TestProj\TestProj\bin\Debug\TestProj.exe" "%1"
But i´m not sure that this command is 100% correctly, and i don´t want to destroy my regestry ^-^

i explain what i want to see:

In Root-namespace of registry i have my file types (named .type, in my example .aatga)
In some cases in registry they have at "Standard" value the value "mytype_auto_file".
In same namespace so we have a key named "mytype_auto_file" with subkeys listed in my example code (shell => open => command)
Here the "Standard"-value is

Code: Select all

"path_to_exe" "%1"
no i have a problem with the quotes (")

Have i include or escape this for -Data-Param or can i type it like my code example shows?
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Register a file association via command line

Hello Kagurame and welcome to Advanced Installer forums,

Thank you for your interest in Advanced Installer.

Please keep in mind that in order to add a new registry key you should use a command line like this:

Code: Select all

AdvancedInstaller.com /edit MyProject.aip /NewReg -RegKey HKCR\MyRegkey\*
Also, in order to add a new string (REG_SZ type) registry value to your project you should use a command line like this:

Code: Select all

AdvancedInstaller.com /edit MyProject.aip /NewReg -RegValue HKCR\MyRegkey\MyValue -Data #%MyStringValue
Please, take a look on our "New Registry Entry Command" article.

Let us know if this helps, otherwise please give us more details about your scenario (maybe exemplify).

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Kagurame
Posts: 3
Joined: Thu Oct 11, 2012 1:55 pm

Re: Register a file association via command line

Thanks for reply ;)

I´ve found the solution out while testing and now its work fine.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Register a file association via command line

Hello,

I'm glad you got this working. Also, if you want to contribute to Advanced Installer forums with the entire workaround for this issue you could post here the solution to help future users in the same situation.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Kagurame
Posts: 3
Joined: Thu Oct 11, 2012 1:55 pm

Re: Register a file association via command line

Code: Select all

NewReg -RegKey HKCR\.ext\*
NewReg -RegValue HKCR\.ext\(Default) -Data ext_auto_file
NewReg -RegKey HKCR\ext_auto_file\*
NewReg -RegValue HKCR\ext_auto_file\(Default) -Data "Description for Mouse Over"
NewReg -RegKey HKCR\ext_auto_file\DefaultIcon\*
NewReg -RegValue HKCR\ext_auto_file\DefaultIcon\(Default) -Data "Icon",0
NewReg -RegKey HKCR\ext_auto_file\shell\open\*
NewReg -RegValue HKCR\ext_auto_file\shell\open\(Default) -Data "Open your Programm with (Description for entry by right mouse click)"
NewReg -RegKey HKCR\ext_auto_file\shell\open\command\*
RewReg -RegValue HKCR\ext_auto_file\shell\open\command\(Default) -Data """Programm to run"" ""%1 (Parameter!)"""
Here a example for *.ext-Files.

In this part:

Code: Select all

NewReg -RegKey HKCR\ext_auto_file\shell\open\*
NewReg -RegValue HKCR\ext_auto_file\shell\open\(Default) -Data "Open your Programm with (Description for entry by right mouse click)"
NewReg -RegKey HKCR\ext_auto_file\shell\open\command\*
RewReg -RegValue HKCR\ext_auto_file\shell\open\command\(Default) -Data """Programm to run"" ""%1 (Parameter!)"""
you can add more entries like this:

Code: Select all

NewReg -RegKey HKCR\ext_auto_file\shell\edit\*
NewReg -RegValue HKCR\ext_auto_file\shell\edit\(Default) -Data "Edit with notepad"
NewReg -RegKey HKCR\ext_auto_file\shell\edit\command\*
RewReg -RegValue HKCR\ext_auto_file\shell\edit\command\(Default) -Data """C:\Windows\notepad.exe"" ""%1"""
If you have here

Code: Select all

NewReg -RegValue HKCR\ext_auto_file\shell\edit\(Default) -Data "Edit with notepad"
a clear value (Dont write this line), the text will be an standard translation from windows, if windows knewn the command (open => "Open", in German "Öffnen"; edit => "Edit", in German "Bearbeiten" etc. etc.)

Maybe a problem is the % by Parameters because AdvancedInstaller can interprete this as variable (if you have more than one % ).
We´re testing this an have opened a ticket that variables (%%) don´t works fine (my workmate do this).

lg. Kagurame

Return to “Building Installers”