Reputation: 3787
On Windows 7 SP1, from CMD window, run command regsvr32 none.dll
, regsvr32 will fail with exit code 3. This is the expected behavior of regsvr32, as stated in Raymond Chen's blog post.
Procmon verifies this as well.
However, when checking regsvr32's exit code with echo %ERRORLEVEL%
, I got zero. WHY?
Upvotes: 0
Views: 908
Reputation: 3787
Thanks to Marks comment. I was just tripped by CMD's sneaky behavior.
To know the exit code of a GUI process like regsvr32
, the CMD command line has to be:
start /wait regsvr32.exe none.dll
What is special about regsvr32
is: If we run regsvr /s xxx.dll
, /s
makes regsvr totally silent, looking very much like a CUI program. So users are more easily get trapped.
But if we execute regsvr32 none.dll
inside a .bat
/.cmd
batch script, start /wait
is not required. Such discrepancy (on command prompt vs inside batch script) often causes trouble for the unwary. Sigh.
Upvotes: 1