1.

Solve : Batch script to rename a word in vbs file?

Answer»

I'm trying to write a batch script to rename a certain word ina .vbs file.

BASCIALLY i want it to find this...
'S20120411
change to...
'S20120412

so i want it to find S2012 or 'S2012 what ever easier and change 0411 to 0412 then the next day change 0412 to 0413 and so on for everyday but modifying the vbs file not making a copy. as you can see its the date i was thinking maybe it can use the system date and paste it everyday if its possbile.Seems like it would be easier for the vbscript to just pull the current date.The thing is i have a vbs script thats going to automate through a webpage to download a file. Right now i have everything setup except for finding that file . The file NAME changes everyday to today's date and there no unqiue id for it so i get grab directly.
I was thinking maybe use the following formula for the date in the batch script but i' m not SURE if that would work.

for /f "tokens=1-5 delims=/ " %%d in ("%date%")


i have this CODE right now just need to make some changes..


Code: [SELECT]@echo off
SETLOCAL=ENABLEDELAYEDEXPANSION

rename testfile.txt text.tmp
for /f %%a in (text.tmp) do (
set foo=%%a
if !foo!==ex3 set foo=ex5
echo !foo! >> text.txt)
del text.tmp



Discussion

No Comment Found