user384300
user384300

Reputation: 55

CMD - how to write %

I am using windows cmd and i am trying to do the following:

REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug" /v debugger /t REG_SZ /d "%ENVIROMENT VAR%utils\cdb.exe -pv -p %ld -c """.dump /u /ma c:\utils\1.dmp;qd""" "

As you see, first enviroment varialbe is between % and is expanded by cmd, then %ld should be written as is. However, it is considered to be start of varialbe by CMD, so this fails. I guess i need to add some escape character, but it failed.

How to set this correctly?

Upvotes: 1

Views: 210

Answers (1)

Paddy Fagan
Paddy Fagan

Reputation: 56

Use a caret (^) to escape the % so the problematic line becomes:

REG_SZ /d "%ENVIROMENT VAR%utils\cdb.exe -pv -p ^%ld -c """.dump /u /ma c:\utils\1.dmp;qd""" "

Paddy

Upvotes: 2

Related Questions