Including quotes in registry value using regset

(imported topic written by doubleminus91)

I want to include a string when I set a registry value that has quotes inside of it.

Registry value name: SPath

String: “C:\Program Files (x86)\Application\App\App.exe” /server blah.com /port 4343

Failed attempt: regset "

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\service

" “SPath”="“C:\Program Files (x86)\Application\App\App.exe” /server blah.com /port 4343"

What should I be doing to get these quotes to be included here around the file path…?

(imported comment written by SystemAdmin)

Replace the inner set of double-quotes with %22, so for the last part of your command string you would have:

“%22C:\Prog…App.exe%22 /server blah.com /port 4343”

-Jim

(imported comment written by doubleminus91)

Jim,

This gives me %22 on both sides of the path - they do not seem to translate into quotation marks…

(imported comment written by doubleminus91)

Note that I’ve also tried blackslashes for escaping quotes, double quotes, and some other tricks to no avail.

(imported comment written by JasonHonda)

It looks like you were on the right track, but there is a limitation with regset when there are spaces within escaped quotes. What you’ll want to do instead is create a .reg file and then import it.