I would like to simply get the path with the executable minus any quotes or text surrounding the path and executable.
My initial code:
Code: Select all
@ECHO OFF
reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run > c:\temp1\RegQ.txt
more +3 c:\temp1\RegQ.txt > c:\temp1\RegQ1.txt
setlocal enableDelayedExpansion
>> C:\temp1\OutPut1.txt ( for /f "usebackq tokens=1,* delims= " %%a in ( "c:\temp1\RegQ1.txt" ) do (
set "$vl=%%~b" &set "$vl=!$vl:* =!"
echo.!$vl! ) )
exit
The end result of OutPut1.txt shows what I would like, but to clean up the preceding text and any text after the path/executable so that the final results is similiar to:
c:\<path of file>\<executable>
the query of the registry key can be different depending on which computer operating system is run on either a win7 or win8 box.
Is it possible to clean up the text that comes before and after the path?
This is the initial result I get from the output of OutPut1.txt :
C:\Program Files\IDT\WDM\sttray.exe
"C:\Program Files\Common Files\Java\Java Update\jusched.exe"
C:\Program Files\AirTight\SpectraGuard SAFE\WSAUI.exe /ar 1
"C:\Program Files\McAfee\VirusScan\SHSTAT.EXE" /STANDALONE
C:\Program Files\NVIDIA Corporation\nView\nwiz.exe /installquiet
rundll32.exe C:\Windows\system32\nvHotkey.dll,Start
"C:\Program Files\Renesas Electronics\USB 3.0 Host Controller Driver\Application\nusb3mon.exe"
"C:\Program Files\McAfee\Common Framework\udaterui.exe" /StartedFromRunKey
Auditor Tray Icon REG_SZ "C:\Program Files\McAfee\Policy Auditor Agent\PASysTray.exe"
Intrusion Prevention Tray REG_SZ "C:\Program Files\McAfee\Host Intrusion Prevention\FireTray.exe"
C:\Program Files\Intel\Intel(R) Rapid Storage Technology\IAStorIcon.exe
C:\Program Files\STMicroelectronics\AccelerometerP11\FF_Protection.exe
C:\Program Files\DellTPad\Apoint.exe
REG_SZ "C:\Program Files\Common Files\Adobe\ARM\1.0\AdobeARM.exe"
Speed Launcher REG_SZ "C:\Program Files\Adobe\Acrobat 10.0\Acrobat\Acrobat_sl.exe"
8.0 REG_SZ "C:\Program Files\Adobe\Acrobat 10.0\Acrobat\Acrotray.exe"
* =