Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You can use <a href="http://www.ss64.com/nt/reg.html" rel="nofollow noreferrer">reg</a> command to query appropriate registry key:</p> <pre><code>reg QUERY HKCU\Software\Microsoft\Windows\CurrentVersion\Run &gt; out </code></pre> <p>That will give you the list of keys in file "out", like this:</p> <pre><code> UIWatcher REG_SZ D:\Utils\Ashampoo UnInstaller\UIWatcher.exe SpybotSD TeaTimer REG_SZ C:\Program Files\Spybot - Search &amp; Destroy\TeaTimer.exe SandboxieControl REG_SZ "C:\Program Files\Sandboxie\SbieCtrl.exe" WMPNSCFG REG_SZ C:\Program Files\Windows Media Player\WMPNSCFG.exe </code></pre> <p>You need to parse this list to get first and second token where REG_SZ is delimiter. If you want to stick to the plain batch language (meh...), which is nothing else but the trouble, you will have to use FOR /F command to get the tokens in manner:</p> <pre><code>FOR /F "tokens=1,2 delims=$" %i in (out) do @echo %i %j </code></pre> <p>Before that you will need to replace REG_SZ with some char, lets say $, since FOR doesn't accept string delimiters. The entire process can be put in a single batch file:</p> <pre><code>SETLOCAL EnableDelayedExpansion @echo off &gt; StartUp.txt FOR /F "skip=2 usebackq tokens=* delims= " %%i in (`reg QUERY HKCU\Software\Microsoft\Windows\CurrentVersion\Run`) do ( set LINE=%%i set LINE=!LINE:REG_SZ=$! FOR /F "tokens=1 delims=$" %%j in ('cmd.exe /C echo !LINE!') do echo %%j &gt;&gt; StartUp.txt ) </code></pre> <p>After you run it StartUp.txt should contain full names of programs, each on its own line. The construct 'cmd.exe /C echo !LINE!' is confusing. I put it as a workaround to the problem I had scanning LINE variable. According to the documentation it should just '!LINE!' but it doesn't work for some reason... In case you are interested in !VAR! syntax, see set /?</p> <p>Anyway, batch language sucks big time, so its better to avoid it if possible, or to use it in conjuction with some serious tools like awk, sed, autohotkey etc... Each of them can parse the output of reg command in a single regexp line, while autohotkey can create even a nice GUI for it and u can totally avoid batch script.</p> <p>At the end, dont forget to also can Run section for "All Users".</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload