开发者

Batch File or vbscript that completes multiple tasks

I am looking to do some automating on some imports. I am looking for a way to call multiple scripts to run from either one batch file or vbscript. wha开发者_如何学运维t I am trying to do is the following: 1) rename a file which is done in batch 2) Move the renamed file to another folder 3) Replace specified text within the file 4) Rename the file with a date extension I want to be able to schedule 1 batch file to run and handle all of these tasks from that 1 batch file. I have already written vbscripts to replace text, and move the file when done. Here is what I have so far which is done inside batch. Here is what I have so far which may help you understand what I mean.

(inside the batch file)

            cd C:\NEW
            ren A353*.txt A353.txt
   (step 2) cscript move1.vbs (which moves the file)
   (step 3) cscript TextReplace.vbs (which replaces a string of text in the A353.txt)
   (step 4) I need a script that will rename A353.txt to the month and date in this format MMDD. EX: A3530823.txt.     


Instead of mixing batch and VBScript, I recommend you just put all those tasks in a single VBScript. Here's an example of how to rename a file in VBScript.

Set FSO = CreateObject("Scripting.FileSystemObject")
FSO.MoveFile "C:\MyFile.txt", "C:\YourFile.txt"
' Can continue to use FSO for other operations...

Please note that moving is essentially the same thing as renaming.

If you clarify what else you want, then more help will be forthcoming.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜