views:

25

answers:

1

Hi,

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?

+2  A: 

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

Paddy Fagan
The cmd.exe syntax is so esoteric
PP
Strangly this did not work. I solved this by using %%.
Very odd - which OS? Also are you typing this into the command line directly or using a bat file (from memory %% works from a file, ^ if you're typing it in directly.
Paddy Fagan
Win2008 server.Yes this is from a file.Thanks.