I have a program that opens with a specific shortcut, but the shortcut seems to send parameters to the application. If I go directly to the target directory and double-click, it does not work. However, if I use the command line and pass in a certain argument, the application opens correctly.

I want to open certain file types using the application, but the application must have the parameters, or it will not work. Is it possible to do this sort of thing?


7 Answers 7


Ran into the same problem as @jtpereyda and the solution from @bobbymcr didn't work for me either. I was trying to get all the command line parameters passed into node.js scripts without needing node.exe on the command.

The problem is that if you have already associated the program with the extension via the Open With dialog then you will have created an application association, instead of a file extension association, between the two. And application associations take precedence.

If you don't mind editing the registry you can modify the (Default) key at the following path:


You should replace node.exe with the application you are adjusting.

Or you can just delete the application folder from the HKEY_CLASSES_ROOT\Applications folder entirely and your ftype association will start working.

Be sure to use %* which will pass in the remaining unspecified command line arguments or nothing at all. If you do "%2" "%3" "%4" "%5" you will get 5 empty string params passed into your application when you don't specify any command line arguments.

Finally, if you are not ok with modifying the registry by hand then you can use a freeware tool from Nirsoft - FileTypesManager - http://www.nirsoft.net/utils/file_types_manager.html

File associations will appear at the top of the list, without any text in the first extension column. Just find the name of the executable in the list and select it to modify the command line field for the open action name.

On windows7 the changes were reflected immediately without any reboot or application restarts. However the Nirsoft utility has a feature to "Refresh the Desktop" on any modification, so it leads me to believe that maybe Vista or prior OS versions would cache the data. In which case the utility would be a better bet, otherwise you might need to log off and log on to see the changes.

  • 2
    as a note: it seems that the %1 always should be used to pass the associated file to the program. directly using %* seems not to work. At least i got problem with my ".pl" - perl association on my win 7 May 28, 2015 at 7:26
  • 2
    I got it to work by trial-and-error, resulting in the following Data value: "C:\Program Files\nodejs\node.exe" "%1"%* NOTE: the %* value is NOT in quotes, and has no space between it and previous double-quote. Sep 2, 2015 at 16:47
  • 1
    I also deleted key HKEY_CLASSES_ROOT\.ulaw in the regedit just in case where .ulaw is the extension of the files I was doing the procedure for.
    – Matt
    Sep 2, 2015 at 17:27
  • Ho can we pass the arguments (say 'testing') while opening?
    – Apparao
    Jan 20, 2016 at 14:18
  • Please change this answer to explictly modify "[HKLM|HKCU]\Software\Classes", depending on the installation context. Don't modify HKCR directly. See the "important considerations" for file types and the HKEY_CLASSES_ROOT article. It's an understandable misunderstanding given much of Microsoft's own documentation predates the merged view for HKCR that was introduced circa Windows 2000.
    – Eryk Sun
    Aug 14, 2018 at 17:02

You can do this with assoc and ftype at the command prompt. Open an elevated command prompt and try the following:

ftype MyFileType=C:\MyDir\MyProgram.exe /arg1 /arg2 "%1"
assoc .xyz=MyFileType

This will associate the .xyz extension with MyProgram.exe and will pass the command line /arg1 /arg2 [filename.xyz] to the program to run it.

  • 1
    Accepted because this seems to be the right answer from what I have researched. However, this process seems ineffectual on the system I'm using. I can use ftype and assoc to verify that the changes went through, but it does not affect the program used to open files. Maybe the process has changed in Windows 7?
    – jtpereyda
    Jan 4, 2012 at 3:08
  • Using Marcus Pope's answer make it work correctly on my side using Windows 7. Was trying to play .ulaw file with sox using predefined arguments from it. Note that in addition to delete old application, I also deleted HKEY_CLASSES_ROOT\.ulaw which was defining the file type.
    – Matt
    Sep 2, 2015 at 17:28
  • 1
    CMD's assoc and ftype are legacy commands. They weren't updated to for the extensions to file associations added in Windows XP, 7, and 8. They only modify the file association and ProgId keys under the system key "HKLM\Software\Classes". They don't read or modify per-user HKCU settings, which take precendence, or the newer subkeys such as "Applications" and "SystemFileAssociations", or per-application capabilities keys from "RegisteredApplications". They also don't read or modify the user's choice under "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts".
    – Eryk Sun
    Aug 14, 2018 at 17:28

The person placing the question reports the Best answer doesn't actually work.

I've figured it out for XP, which might apply to later OS.

At a cmd prompt you need two commands: assoc, ftype.

These two can show what is associated and then edit the association but there is a twist, the MS instructions seem to be wrong/incomplete. I was alerted to this by noticing an undocumented association style by known veteran applications, why?

This example enables many arguments to be passed to the associate program.

ftype name_of_assoc="C\blah\aprog.exe" "%1" "%*"

Not a typo that is "%1" "%*". The percent star will not work without the preceeding percent 1.

And that goes live immediately, no requirement to log out etc.

Done right will pass 3 to arg[]

myfile.wotsit file1 file2 file3

Haven't done it but it looks like the following outside quotes would pass -m if the program needs a flag.

ftype name_of_assoc="C\blah\aprog.exe" -m "%1" "%*"
  • I don't think this is correct. Using quotes around "%*" will have the list of arguments be passed as a single argument. Also, you missed the colon after the drive letter. The correct command should be: ftype name_of_assoc="C:\blah\aprog.exe" -m "%1" %*
    – User0
    Apr 7, 2016 at 13:16
  • I'm using the excellent FilesTypeMan program, and in this case you need %1 %* without quotes !!! damn windows Nov 3, 2019 at 10:42

I had a similar problem with an older version of PSP with Windows7

This solution (change the shell\open\command line in the Registry) worked BUT had to have the syntax "C:\MyFolderName\PSP.EXE" %1 NO QUOTES AROUND %1 otherwise this gets interpreted as a constant

  • 1
    why the downvotes? this answer helped me finally get the command right!
    – ylka
    Dec 14, 2017 at 13:44
  • THANK YOU - I had the quotes and it wasn't working Sep 19, 2019 at 10:52

Not the best solution but the easiest one is using a batch file.

Create a bat file like that and set your default program to it for your file extension. And yes, the empty quote after start is necessary:

{app name}.bat

    start "" "{app path}" %1 /edit



    start "" "C:\Program Files\Beyond Compare 4\BCompare.exe" %1 /edit
  • 1
    This is the only solution that worked for me on Windows 10. It helps me to start Word 2013 with the /w option to have a new instance on each launch, which is needed to use Word with virtual desktops. Nov 26, 2018 at 10:59

Here is an extension that seems to do exactly what you want. I've never used it before, but it seems to get good reviews. leave a comment if there are issues.


Make a Windows shortcut and use the following template:

"C:\Windows\system32\mspaint.exe" "c:\data\basejpg.jpg" %1
  • 2
    And how does the user use this to open a file such as xyz.jpg? Nov 30, 2017 at 6:21
  • He asked how to change registry to achieve this.
    – rollsch
    Jul 9, 2018 at 7:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.