Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a .reg script:

Windows Registry Editor Version 5.00
"Application"="C:\\Program Files (x86)\\Java\\jre6\\bin\\java.exe"
"AppParameters"="-Xrs -jar selenium-server-standalone-2.0b1.jar"

I would like to run it from a .bat file, but rather than D:\SeleniumRC I would like to pass the current directory. How can I do this?

share|improve this question

%CD% will get you your current working directory, and you may be able to use the "Reg" command rather than a .reg fragment:

So, maybe something like the following would work for you. Just create a .bat file with the following contents:

REG ADD HKLM\System\CUrrentControlSet\Services\SeleniumRC\Parameters /v Application /t REG_SZ /d "C:\Program Files (x86)\Java\jre6\bin\java.exe"

REG ADD HKLM\System\CUrrentControlSet\Services\SeleniumRC\Parameters /v AppDirectory /t REG_SZ /d "%CD%"

REG ADD HKLM\System\CUrrentControlSet\Services\SeleniumRC\Parameters /v AppParameters /t REG_SZ /d "-Xrs -jar selenium-server-standalone-2.0b1.jar"

(thanks @jscott for the tip)

share|improve this answer
You may want to consider double-quotes around %CD%, should it contain a space. – jscott Sep 28 '11 at 10:17
Agreed - edited to reflect that – Dan Sep 28 '11 at 11:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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