I have a script which reads a line from text. The text itself, each row has a string ending in either REG_DWORD 0x1 or REG_DWORD 0x1000.
The text itself that is being read from is generated but doesn't have all the same string values, but same similiar ending 2 tokens.
My goal is to parse each line, place the string value output to a file, but always have the last 2 tokens removed at the end.
I've tried using Setlocal EnableDelayedExpansion to allow for my string to stay together, but there wasn't any output showing up even on screen.
if I can get assistance on this, please / thank you. Booga73
sample output on screen:
----------------------
Press any key to continue . . .
C:\Windows\system32\vfpodbc.dll
Press any key to continue . . .
C:\Program
Press any key to continue . . .
C:\Windows\Microsoft.NET\Framework\v1.0.3705\vsavb7rt.dll
Press any key to continue . . .
C:\Program
Press any key to continue . . .
C:\Windows\Microsoft.NET\Framework\v1.0.3705\system.enterpriseservices.dll
Press any key to continue . . .
C:\Program
Press any key to continue . . .
----------------------
Sample Text:
C:\Windows\system32\vfpodbc.dll REG_DWORD 0x1
C:\Program Files\Hewlett-Packard\Shared\hpCaslNotification.exe.hpsign REG_DWORD 0x1
C:\Windows\Microsoft.NET\Framework\v1.0.3705\vsavb7rt.dll REG_DWORD 0x1000
C:\Program Files\Hewlett-Packard\Shared\hpqWmiEx.exe REG_DWORD 0x1
C:\Windows\Microsoft.NET\Framework\v1.0.3705\system.enterpriseservices.dll REG_DWORD 0x1000
C:\Program Files\Hewlett-Packard\Shared\HpqToaster.exe REG_DWORD 0x1
Destination File output:
C:\Windows\system32\vfpodbc.dll
C:\Program Files\Hewlett-Packard\Shared\hpCaslNotification.exe.hpsign
C:\Windows\Microsoft.NET\Framework\v1.0.3705\vsavb7rt.dll
C:\Program Files\Hewlett-Packard\Shared\hpqWmiEx.exe
C:\Windows\Microsoft.NET\Framework\v1.0.3705\system.enterpriseservices.dll
C:\Program Files\Hewlett-Packard\Shared\HpqToaster.exe
Code: Select all
@ECHO OFF
for /f "usebackq tokens=* delims= " %%a in ("c:\temp1\SharedDll1.txt") do (
Call :ChkExec %%a
)
pause
:ChkExec %*
:: Setlocal EnableDelayedExpansion
set rgVal1=%*
:: echo my String value is: %rgval1%
for /f "usebackq tokens=1,2,3*" %%a in ('%rgval1%') do (
set rval1=%%a
set rval2=%%b
set rval3=%%c
set rval4=%%d
set rval5=%%e
set rval6=%%f
set rval7=%%g
set rval8=%%h
:: echo %rval1% %rval2% %rval3% %rval4% %rval5% %rval6% %rval7% %rval8%
echo %rval1%
pause
)
exit /b