Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Example of current batch file:
Line1
Line2
Line3
Line4
MY PROG NAME=%PROGNAME%
Line6
Line7
SET THIS IS IT=
LINE9
MY PROG NAME=
LINE11
I need my batch file to search the existing batch file and edit the "MY PROG NAME=" line to "MY PROG NAME=C:\Program Files..."The catch is their are two of the same entries. IE: MY PROG NAME=%PROGNAME% and MY PROG NAME=
The second entry will always be on the same line in the batch file if that helps.
**This is not the actual file but a lot shorter for example purposes**
If any additional info is required please let me know.
@echo off & setLocal EnableDelayedExpansion > newfile
for /f "tokens=* delims= " %%a in (my.bat) do (
set /a N+=1
if !N! equ 10 (
echo MY PROG NAME=C:\Program Files... >> newfile
) else (
echo %%a >> newfile
)
)
=====================================
If at first you don't succeed, you're about average.M2
Report Offensive Follow Up For Removal
![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |