Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Querrys  (Read 2217 times)

0 Members and 1 Guest are viewing this topic.

almn

  • Guest
Querrys
« on: March 23, 2006, 07:36:51 PM »
Hello,

I would like to know how to querry a registery value, meaning check for the value of a given key and if the ky is equal to abcde call a certain program.

And also the same for the running processes, if notepad.exe is running call a certain program.

Thank You

Almn

Sidewinder



    Guru

    Thanked: 139
  • Experience: Familiar
  • OS: Windows 10
Re: Querrys
« Reply #1 on: March 24, 2006, 06:04:58 AM »
If your machine supports it, try using TASKLIST and filtering the results thru FIND:

Code: [Select]
tasklist | find "notepad.exe" > nul & if not errorlevel 1 echo Notepad is executing

Note: Not all OSes support the TASKLIST command.

Need more info on the registry request. The hive and the key would be helpful.

 8-)
The true sign of intelligence is not knowledge but imagination.

-- Albert Einstein

almn

  • Guest
Re: Querrys
« Reply #2 on: March 24, 2006, 03:39:01 PM »
Thanks ,
 
The key would be "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run"

and the hive would be "Kernel"

Thank You

Almn

DosItHelp



    Intermediate
    Re: Querrys
    « Reply #3 on: March 24, 2006, 10:36:05 PM »
    Does this work for you?

    Code: [Select]
    set k=HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
    set v=Kernel
    set d=abcde
    reg query %k% /v %v%|findstr /i "%v%.REG_SZ.%d%">NUL&&echo.call a certain program
    In case the search string "%v%.REG_SZ.%d%" is not correct run reg query %k% /v %v% by itself to see what the reg function returns and make adjustments as necessarily.

    A simple reg query %k% /v %v%|find /i "%d%">NUL&&... may also do it for you.
    Remove the /i switch for case sensitive comparison.

    More info about conditional execution using && or || is available
    @ http://dostips.cmdtips.com/DtCodeSnippets.php

    Hope this helps ;)
    « Last Edit: March 24, 2006, 10:42:15 PM by DosItHelp »