I am new with the batch script.
I have values in parameter.txt file as below
[CUSTOM_1]
$$CURR_YEAR_MONTH_WID_C1=201212[CUSTOM_2]
$$CURR_YEAR_MONTH_WID_C2=201303then in my test.bat file, I need a value of variable "$$CURR_YEAR_MONTH_WID_C1" as 201212
and "$$CURR_YEAR_MONTH_WID_C2 as 201303.i am not sure what should i put in IF ELSE block, i have written batch script(test.bat) as below
rmdir "D:\Batch_files\Datacollection files rahw"
md "D:\Batch_files\Datacollection files rahw"
set dd=%date%
set yyyy=%dd:~10,4%
set mm=%dd:~4,2%
for /f "delims=" %%x in (D:\param_files\Parameter_File_rahw_org.txt) do (
IF %%x ==CUSTOM_1 (
set yyyymm=%%x
echo %yyyymm%
) ELSE (
echo not matched
)
)
@echo off & setlocal enabledelayedexpansion
for /f "tokens=*" %%a in (file.txt) do set %%a 2>nul
set $$
pause
for %%a in (1 2) echo.!$$CURR_YEAR_MONTH_WID_C%%a!
Yes (14) | ![]() | |
No (14) | ![]() | |
I don't know (15) | ![]() |