6

Is it possible to set default parameters for an application in Windows XP? (without using a shortcut) For example, I want Firefox to run with the parameters "-p username" when I run "firefox.exe".

2
  • How do usually you start Firefox? Direct from the install directory or via shortcut or batch file? Jul 27, 2009 at 8:06
  • 1
    I start using a shortcut. An example problem here is that I can't associate ".htm" files with a shortcut, they can only be associated with an executable file.
    – swamplord
    Jul 27, 2009 at 22:06

7 Answers 7

8
+50

Run regedit and take a look at the key:

`My Computer\HKEY_CLASSES_ROOT\FirefoxHTML\shell\open\command`

Put -p username into the command string at the appropriate place.

I believe this affects all users on the machine, however.

You would also be wise to backup this part of the registry. In RegEdit, select the key:

 `My Computer\HKEY_CLASSES_ROOT\FirefoxHTML`

and choose File | Export.... Choose the Selected Branch option to backup this part of the registry before changing it.

1
  • maybe need to remove -osint see support.mozilla.org/ig/questions/1359474 this worked for me to get dev tools on start "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" -devtools -url "%1"
    – Tilo
    Aug 31, 2023 at 23:41
3

1) Open notepad, paste this in, and save it as firefox.bat

@echo off
firefox-original.exe -p username %*

2) Using a batch file compiler (such as this one or this one which both seem to do what you need, but note that I have not personally tested either), compile firefox.bat to firefox.exe

3) Navigate to your Firefox install directory, and rename firefox.exe to firefox-original.exe

4) Copy and paste your compiled batch file, firefox.exe, to your Firefox install directory.

Now when firefox.exe is launched, either directly, by shortcut, or by associated file type, your compiled batch file will run firefox-original.exe with your custom parameters and with the parameters passed during launch.

4
  • I tried this and unfortunately it doesn't work when I try to open html files with the compiled firefox.exe.
    – swamplord
    Sep 10, 2009 at 9:22
  • 1
    Also, it will break every time you update firefox? Sep 10, 2009 at 10:20
  • I am not sure about that, because I think "firefox-original.exe" will be updated everytime.
    – swamplord
    Sep 10, 2009 at 10:54
  • It probably will break, but this is a pretty wacky hack so it's not unexpected Sep 10, 2009 at 17:07
3

You can specify default parameters for any file (for example HTML files). Just:

  1. Open My Computer
  2. From Tools select Folder Options
  3. Go to File types tab
  4. Find the file type you want (HTM or HTML or both!)
  5. Click on Advanced button
  6. Select open action from actions list
  7. Click on Edit
  8. Add any parameter you want in text-box labled Application used to perform action:
  9. Click on OK and OK and then Close

Now when user opens a HTM or HTML file, firefox (or any application that is associated to HTM or HTML files) will run by the specified parameters and opens that file.

But as far as i know, there is no way to specify a default parameter for a particular EXE when user clicks on it.

2

You could just create a batch file that runs Firefox with the arguments, and always use this to run, by adding the Firefox directory to your PATH environmental variable and simply calling run.bat

1
  • That's what linux distributions do! That's why you see compiz.real as executable, for example.
    – LiraNuna
    Sep 9, 2009 at 22:57
1

Had to do this to open Dia in integrated mode. Open regedit and find your extention in HKEY_CLASSES_ROOT. In my case .dia has 'dia_auto_file' as value.

HKEY_CLASSES_ROOT > .dia = dia_auto_file

Find that value inside HKEY_CLASSES_ROOT. Open up this value all the way until 'command':

HKEY_CLASSES_ROOT > dia_auto_file > shell > open > command

Here you can edit the command line like:

"F:\Portable\Dia\bin\diaw.exe" "%1"

to

"F:\Portable\Dia\bin\diaw.exe" "%1" --integrated

0

Always use the same shortcut for Firefox? It's not, to my knowledge, possible to set this on a per-application basis, just per-shortcut.

2
  • Will not work when opening HTML files, for example.
    – LiraNuna
    Sep 9, 2009 at 22:57
  • That's completely correct. Sep 10, 2009 at 10:18
0

An alternative to using a batch file compiler is to use an AutoIt script, which can be compiled into an exe file.
As has already been discussed here, you will have to rename the executable and replace it with the compiled script, which has its disadvantage when the executable is updated.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .