3

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?

mcintyre321
  • 169
  • 1
  • 6

1 Answers1

6

%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)

George Tasioulis
  • 1,969
  • 2
  • 16
  • 17
Dan
  • 15,280
  • 1
  • 35
  • 67