PDA

View Full Version : Regedit: Modifying a Default entry with command-line batch


Wamplet
10-12-2006, 02:39 PM
Currently, a legacy SAP setup file is added in here and not removed from the installer. When i put in a software cd to install something that autoruns, there is a chance that the sap setup is launched again and prohibits me from actually running the setup file on the cd. I believe this is in part due to the default location in the registry as well as the autorun not referencing the setup.exe on the cd itself by a direct path name (assuming it is on the cd drive, while the registry is telling it the default path is elsewhere).


I have the following key:

HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\setup.exe(Default) with a value of C:\Program Files\SAP\FrontEnd\SAPgui\FILC\setup.exe

The default entry should be blank.

2 more keys which need no modification, as they are unaltered by the SAP setup:

HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\setup.exe\BlockOnTSNonInstallMode has a value of 1

HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\setup.exe\RunAsOnNonAdminInstall has a value of 1



However, 1 more key is created during the SAP install:

HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\setup.exe\Path has a value of C:\Program Files\SAP\FrontEnd\SAPgui\FILC

I can delete with the following line:

reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\setup.exe" /v Path /f



The hard part i am trying to figure out is how do i clear the Default value data of C:\Program Files\SAP\FrontEnd\SAPgui\FILC\setup.exe and reset it to no value or blank in the first key at the top.


I would like to see if anyone knows what I need to do to clear the default value of a key with a batch file using the reg add/delete command.

I don't know if it can be made with 1 delete line or requires a delete line to wipe out the key or value and then a second add line that adds the key or a blank value.

Wamplet
10-12-2006, 03:09 PM
Here is what i have done so far:

reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\setup.exe" /f

reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\setup.exe" /v BlockOnTSNonInstallMode /t REG_DWORD /d 1

reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\setup.exe" /v RunAsOnNonAdminInstall /t REG_DWORD /d 1


I delete the key, then recreate the key with it's 2 entries. I gather the default entry is created with the first add, since it is not implied yet shows up with a default blank value.

I think this will do for now. If anyone can condense this into 1 or 2 lines, without having to delete the entire key to fix it, let a brotha know.