Add registry key via Active startup

-2

I am trying to add a key to all users on a computer, doing this by using Active Startup. But i get Syntax error because my keyname i want to add(FormSuggest Password) have a space between, any tips ?

reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\IECachedPassword" /v "Version" /d "1" /t REG_SZ /f

reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\IECachedPassword" /v "StubPath" /d "reg add HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main /v "FormSuggest Passwords" /d "no" /t REG_SZ /f" /f

If i try to write

FormSuggest_Passwords

I get no errors.

If i surround the subkey with quotation i get syntax error either way

reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\IECachedPassword" /v "StubPath" /d "reg add "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main" /v "FormSuggest Passwords" /d "no" /t REG_SZ /f" /f

I am trying disable internet explorer to suggest saving password. Windows 7 with IE11. Any help ?

tommynh

Posted 2015-09-15T13:31:24.893

Reputation: 1

Answers

0

The Reg add command reference at technet.microsoft.com does not give any clue, but as per reg.exe description at ss64.com:

Backslash characters

The REG command will interpret \ as an escape for the character that immediately follows it. To include a quote mark (") in the data, prefix it with the escape character e.g. Here is \" a quote.

Used %_sKey1% and %_sKey2% variables for subkeys to make the code snippet more readable (and omitted default /t REG_SZ in both cases):

set "_sKey1=SOFTWARE\Microsoft\Active Setup\Installed Components\IECachedPassword"
set "_sKey2=Software\Microsoft\Internet Explorer\Main"

reg add "HKLM\%_sKey1%" /v "StubPath" /d "reg add \"HKCU\%_sKey2%\" /v \"FormSuggest Passwords\" /d \"no\" /f" /f

Let's retrace the last long command again for better readability, splitted over multiple lines:

reg add "HKLM\%_sKey1%" /v "StubPath" ^
/d "reg add \"HKCU\%_sKey2%\" /v \"FormSuggest Passwords\" /d \"no\" /f" /f

JosefZ

Posted 2015-09-15T13:31:24.893

Reputation: 9 121

Thanks, the backslash for escaping the quotation worked like a charm! – tommynh – 2015-09-16T06:09:50.670

1

This line makes no sense to me:

reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\IECachedPassword" /v "StubPath" /d "reg add HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main /v "FormSuggest Passwords" /d "no" /t REG_SZ /f" /f

It looks like it should have been two separate commands, but you've somehow embedded one inside the other (or truncated one, and appended another directly onto it?), causing improper quotation usage (you can't embed double-quotes within double-quote unless you escape them -- by doubling them up: "").

To me, this just looks like a bad copy-paste job.

Ƭᴇcʜιᴇ007

Posted 2015-09-15T13:31:24.893

Reputation: 103 763