Link to home
Start Free TrialLog in
Avatar of RHoover673
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
Avatar of chaau
chaau
Flag of Australia image

Are you sure you want to do this with the batch file. VBS script will be much easier
Avatar of Kimputer
Kimputer

Even notepad is faster
Search StoreID=
Replace StoreID=5555
Avatar of RHoover673

ASKER

VBS is fine, can you provide example?
Thank You
ASKER CERTIFIED SOLUTION
Avatar of Kimputer
Kimputer

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
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.
Thank You