0

I've to add a script to windows registry via command line as follow:

Reg add HKCU\Software\...\.\.. /v backUp /t REG_SZ /d "%~dp0\backUp.bat" /f 

The script is called "setup.bat" it contains only the above line. BTW backUp.bat is running at the same dir as the "setup.bat" so for that i'm using %~dp0 to get the full path of the script dir. I surrounded %~dp0 by ", because some path contains spaces.. So, normally when i run i set properly the full path of the backUp.bat, whenever the script is running, but the problem is that i get a double slash before backUp.bat in my registry, look:

C:\Users\marwen\Desktop\bin\\backUp.bat 

If i change the command as this:

Reg add HKCU\Software\...\.\.. /v backUp /t REG_SZ /d "%~dp0"\backUp.bat /f 

Same here, the result is faulty :

C:\Users\marwen\Desktop\bin"\backUp.bat 

How to solve this ?

1 Answer 1

1

untested but Reg add HKCU\Software\...\.\.. /v backUp /t REG_SZ /d "%~dp0backUp.bat" /f without the slash should do it.

Sign up to request clarification or add additional context in comments.

1 Comment

Works.., this really silly, notepad++ highlight it as a string.. anyway thank you!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.