Formatting a command Statement in Win7 to reset the rearm function


I hope the straight dope gang can straighten me out on this. It involves resetting a Windows 7 function called Rearm Rearm can be reset three times and then a bunch of nags turn up in the form of screen messages and desktop resets.

The software forums shy away from answering this question.

Stated simply I need to replace what appears in this code

reg load HKLM\MY_SYSTEM “%~dp0Windows\System32\config\system”

I am rote copying the first line of a batch file but there are errors in it.

I do not know what My_System refers to. It could be the Win7 Computer Name
which for example is lon-PC when you look it up in the search bar.

There is what looks like a stray Zero at dp0Windows which may be a typo.
None of this was ever clarified for the batch file anywhere.

I also don’t know if there is a shorthand for truncation in all that % tilde business.
The remaining two lines of code can be solved if I know this one.

The error code for this line is:

File name, directory name or volume label syntax is incorrect.

I have run the batch file from the root directory C:

The format for the rearm command is simply “slmgr -rearm”. You don’t need to hack around in the registry to do a rearm type of reset. As you stated, you may do this three times. After that you need to either purchase a license or the software will go into reduced functionality mode.

If you are trying to hack around in the registry to reset the rearm command so that you can use it more than three times, that’s a license violation, and you cannot discuss that here on the SDMB.

There sure are. That command was evidently authored by someone with approximately zero clue about Windows. It’s too messed-up to even begin to guess what was intended.

Actually, “~%dp0” is completely valid syntax … in a CALL or FOR command or inside a batch / cmd file. The rest of the syntax is also completely plausible.

The OP says he was copying stuff he doesn’t understand out of a batch file. So the issue isn’t that the given command line is gibberish. That line isn’t gibberish; it’s perfectly cromulent Windows cmdfile coding.

The problem is the OP lacks enough context to get everything else right. And as the moderator says, we’re not going to provide him that context.

Not necessarily a license violaton. The registry manipulation is a perfectly valid way to ensure ones license is usable.

As to the OP’s questions… there is nothing to correct, the command he quoted is letter perfect, its what works for everyone.

Yes, “%~dp0” is a legal thing. I know that. But in the context “%~dp0Windows\System32\config\system” it’s problematic. It expands to the full path (drive letter and folder, no filename) of the executing batch file. Appending “Windows\System32…” to that doesn’t give you the Windows system folder. It might, if you put the batch file in the root folder of the drive containing the Windows folder. If the batch file is on any other drive or in a folder, it’ll fail. It shows ignorance of the fact that a perfectly good, simple environment variable for the absolute path to the Windows folder exists.

The “reg” command overall doesn’t make sense. It appears to be trying to load the file that backs the system registry into the registry. You can’t do that. The input file must be a “.hiv” file created by the “reg save” command (see

Probably best to close this one.

samclem, moderator