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".
-
How do usually you start Firefox? Direct from the install directory or via shortcut or batch file?– Umber FerruleJul 27, 2009 at 8:06
-
1I 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.– swamplordJul 27, 2009 at 22:06
7 Answers
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) 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.
-
I tried this and unfortunately it doesn't work when I try to open html files with the compiled firefox.exe. Sep 10, 2009 at 9:22
-
1
-
I am not sure about that, because I think "firefox-original.exe" will be updated everytime. 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
You can specify default parameters for any file (for example HTML files). Just:
- Open My Computer
- From Tools select Folder Options
- Go to File types tab
- Find the file type you want (HTM or HTML or both!)
- Click on Advanced button
- Select open action from actions list
- Click on Edit
- Add any parameter you want in text-box labled Application used to perform action:
- 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.
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
-
That's what linux distributions do! That's why you see compiz.real as executable, for example.– LiraNunaSep 9, 2009 at 22:57
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
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.
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.