[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More
Experts Exchange Solution brought to you by
"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.
Open in new window
keep in mind file has many other parameters and I want to change only one
Considering 93 percent of companies file for bankruptcy within 12 months of a disaster that blocked access to their data for 10 days or more, planning for the worst is just smart business. Learn how Acronis Backup integrates security at every stage
REM Adds a parameter value to an existing parameter field in a text file PFile. e.g.
REM AddParam params.txt param2 newval2
REM PFile structure assumption:
REM Makes new parameter file newfile.txt in current folder. Adjust the path & filename to your needs.
if exist %PNewFile% del /q %PNewFile%
if [%PFile%] equ  echo Missing Parameter filename& exit /b 1
if [%PField%] equ  echo Missing Parameter field name to revise& exit /b 1
if [%PNewVal%] equ  echo Missing Parameter value to add& exit /b 1
if not exist %PFile% echo File %PFile% does not exist& exit /b 1
find /i "%PField%=" %PFile%>nul
if %errorlevel% gtr 0 echo Parameter field: %PField% not found& exit /b 1
for /f "tokens=1-2 delims==" %%a in ('type %PFile%') do (
if /i [%PField%] equ [%%a] (
echo [%PField%] equ [%%a]
echo %PField%=%%b;%PNewVal%>> %PNewFile%
) else (
echo %%a=%%b>> %PNewFile%
if [%found%] equ  del /q %PNewFile%& exit /b 1
exit /b 0
AddParam params.txt param2 newval2
Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.