RHoover673
asked on
Modify Text file
Hello,
I am trying to create a batch file that will modify a text file by pre-pending an existing value with several numbers.
For example:
The file has an entry called StoreID=97882
I would like the batch command to open the file, find the StoreID= and add four numbers in front of the existing numbers
Before: StoreID=97882
After: StoreID=555597882
Thank You for any help
I am trying to create a batch file that will modify a text file by pre-pending an existing value with several numbers.
For example:
The file has an entry called StoreID=97882
I would like the batch command to open the file, find the StoreID= and add four numbers in front of the existing numbers
Before: StoreID=97882
After: StoreID=555597882
Thank You for any help
Are you sure you want to do this with the batch file. VBS script will be much easier
Even notepad is faster
Search StoreID=
Replace StoreID=5555
Search StoreID=
Replace StoreID=5555
ASKER
VBS is fine, can you provide example?
Thank You
Thank You
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank You, but the issue is that I need to keep the existing number and add the new 5555 to the beginning of the existing number
Before: StoreID=97882
After: StoreID=555597882
apologies if I was not clear
Before: StoreID=97882
After: StoreID=555597882
apologies if I was not clear
Apparently you didn't try the code, otherwise you would see that everywhere it would change exactly as you described?
That is what that will do, if you replace StoreID= with StoreID=5555, then StoreID=97882 will become StoreID=555597882.
I also agree that you don't need code to do this. Any text editor worth having has a find/replace feature.
I also agree that you don't need code to do this. Any text editor worth having has a find/replace feature.
ASKER
Thank You