Link to home
Start Free TrialLog in
Avatar of jspade_69
jspade_69

asked on

Script to Replace Text in a file

Need a little help. I have a vbscript that will open up a file extension and change "Program Files" text to "Program Files (x86)". The problem is that if "Program Files (x86)" already exist in the file the script is apending and changing to  "Program Files (x86) (x86)". Trying to find a way to have the script look for "Program Files (x86)" and if exist do nothing, but continue to change "Program Files" to "Program Files (x86)". Here is the script:


Thanks
Test.vbs
Avatar of als315
als315
Flag of Russian Federation image

Can you show your text file?
May be there is something like Program Files\ and Program Files (x86)\?
ASKER CERTIFIED SOLUTION
Avatar of Bernard Savonet
Bernard Savonet
Flag of France image

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
Avatar of jspade_69
jspade_69

ASKER

Thanks fibo...you're 1st suggestion worked like a champ....so simple yet so affective!   By the way i originally tried the 2nd option before posting and it didn't work.

Thanks again
B-) Glad it worked and I could help. Thx for the grade and points!