Reading file with special characters
Posted: 07 Oct 2018 07:50
I am trying to read a file line by line that contains special characters like ")", "&" without success as I get error like
"-10314679.html: was unexpected at this time.".
Here is the code.
The file _HashList.tmp contains :
How can I overcome this problem?
"-10314679.html: was unexpected at this time.".
Here is the code.
Code: Select all
for /f "tokens=1 delims=@" %%A in (_HashList.tmp) do (
call set myParam="%%A"
call :myParseLine %%myParam%%
)
exit /b
:myParseLine
call set myParam=%~1
call set myPartLine=%myParam:~0,8%
if "%myPartLine%" == "CertUtil" (
exit /b
)
if "%myPartLine%" == "MD5 hash" (
call set "myPartLine=%myParam:~12,-1%"
call set myPartLine=!myPartLine!;
call echo | set /p=%%myPartLine%% >> z:\utilities\_HashDatabase.tmp
exit /b
)
call echo %%myParam%% >> z:\utilities\_HashDatabase.tmp
exit /b
Code: Select all
MD5 hash of z:\Church\Messages\Emails\19981112-The Stranger- You got to read this.... (fwd)-10314679.html:
966b538d0f52fc66bbb7ef4fd98ec1ca
CertUtil: -hashfile command completed successfully.
MD5 hash of z:\Church\Messages\Emails\20061013-God_s perfect will-Q &-266668.html:
32b3c1381bbff6f6d94fe00355c3bf29
CertUtil: -hashfile command completed successfully.