Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a .reg script:

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SeleniumRC\Parameters]
"Application"="C:\\Program Files (x86)\\Java\\jre6\\bin\\java.exe"
"AppDirectory"="D:\\SeleniumRC"
"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

1 Answer 1

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

http://www.petri.co.il/reg_command_in_windows_xp.htm

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
1  
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

 
discard

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.