My loginscript checks for presence of keys under HKCU.

E.g. reg query HKCU\Software\MyCompany /v loginscriptversion | find /C "1.0" > nul
However reg query still returns ERROR: The system was unable to find the specified registry key or value.

So what do I do? I wonder if there is a vbscript that can behave like reg query?
e.g. cscript RegQuery.vbs HKCU\Software\MyCompany /v loginscriptversion | find /C "1.0" > nul
EXCEPT not displaying ERROR ?

Any help would greatly be appreciated.

--
-- HAL07, Engineering Services, Norway

Re: A REG QUERY that does not return "ERROR" when key not found by Tom

Tom
Thu May 08 15:50:42 CDT 2008

On May 8, 4:38 pm, HAL07 <yahoo...@online.yahoo.com> wrote:
> My loginscript checks for presence of keys under HKCU.
>
> E.g. reg query HKCU\Software\MyCompany /v loginscriptversion | find /C "1.0" > nul
> However reg query still returns ERROR: The system was unable to find the specified registry key or value.
>
> So what do I do? I wonder if there is a vbscript that can behave like reg query?
> e.g. cscript RegQuery.vbs HKCU\Software\MyCompany /v loginscriptversion | find /C "1.0" > nul
> EXCEPT not displaying ERROR ?
>
> Any help would greatly be appreciated.
>
> --
> -- HAL07, Engineering Services, Norway

Try ...

reg query HKCU\Software\MyCompany /v loginscriptversion | find /C
"1.0" > nul 2>&1

Watch for line wrap - that's supposed to be all one line.

BTW, why post this in a VBScript group when it is a command console
issue. Better groups might be
microsoft.public.win2000.cmdprompt.admin or alt.msdos.batch.nt.

Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/

Re: A REG QUERY that does not return "ERROR" when key not found by James

James
Thu May 08 18:05:18 CDT 2008

"HAL07" <yahoohal@online.yahoo.com> wrote in message
news:ebP4auUsIHA.3680@TK2MSFTNGP05.phx.gbl...
> My loginscript checks for presence of keys under HKCU.
>
> E.g. reg query HKCU\Software\MyCompany /v loginscriptversion | find /C
> "1.0" > nul
> However reg query still returns ERROR: The system was unable to find the
> specified registry key or value.
>
> So what do I do? I wonder if there is a vbscript that can behave like reg
> query?
> e.g. cscript RegQuery.vbs HKCU\Software\MyCompany /v loginscriptversion |
> find /C "1.0" > nul
> EXCEPT not displaying ERROR ?
>
> Any help would greatly be appreciated.

Try redirecting the error output of reg.exe to Nul: (watch for wrapping):

reg.exe Query HKCU\Software\MyCompany /v loginscriptversion 2>Nul: | find /C
"1.0" >Nul:



Re: A REG QUERY that does not return "ERROR" when key not found by HAL07

HAL07
Thu May 22 11:23:37 CDT 2008

James Whitlow wrote:
> "HAL07" <yahoohal@online.yahoo.com> wrote in message
> news:ebP4auUsIHA.3680@TK2MSFTNGP05.phx.gbl...
>> My loginscript checks for presence of keys under HKCU.
>>
>> E.g. reg query HKCU\Software\MyCompany /v loginscriptversion | find /C
>> "1.0" > nul
>> However reg query still returns ERROR: The system was unable to find the
>> specified registry key or value.
>>
>> So what do I do? I wonder if there is a vbscript that can behave like reg
>> query?
>> e.g. cscript RegQuery.vbs HKCU\Software\MyCompany /v loginscriptversion |
>> find /C "1.0" > nul
>> EXCEPT not displaying ERROR ?
>>
>> Any help would greatly be appreciated.
>
> Try redirecting the error output of reg.exe to Nul: (watch for wrapping):
>
> reg.exe Query HKCU\Software\MyCompany /v loginscriptversion 2>Nul: | find /C
> "1.0" >Nul:
>
>

Thanks! I was more into looking for a vbscript that behaved like reg query, but your solution worked fine, James.

command_1 2>NUL | command 2 >NUL

Now I know even more about command-line :)

--
-- HAL07, Engineering Services, Norway