本帖最后由 apang 于 2013-12-10 09:37 编辑
- Set fso = CreateObject("Scripting.FileSystemObject")
- f = "" : path = "E:\network data"
- For Each file in fso.GetFolder(path & "\file0").Files
- If LCase(Right(file.Name,4)) = ".txt" and _
- LCase(file.Name) <> "tj.txt" Then f = file : Exit For
- Next
-
- If f <> "" Then
- fso.GetFile(path & "\file0\tj.txt").Delete
- fso.GetFile(f).Name = "tj.txt"
- Else WScript.Quit
- End If
-
- Set ws = CreateObject("WScript.Shell")
- ws.Run chr(34) & path & "\P1.EXE" & chr(34),,true
- ws.Run chr(34) & path & "\P2.EXE" & chr(34),,true
-
- n = 3
- While fso.FolderExists(path & "\file" & n)
- n = n + 1
- Wend
-
- strNewFolder = path & "\file" & n
- fso.CreateFolder(strNewFolder)
-
- fso.MoveFile path & "\file1\*",strNewFolder & "\"
- For Each file in fso.GetFolder(path & "\file2").Files
- strNewFile = file.Name
- While fso.FileExists(strNewFolder & "\" & strNewFile)
- strNewFile = "BAK_" & strNewFile
- Wend
- fso.GetFile(file).Move strNewFolder & "\" & strNewFile
- Next
复制代码 保存为test.vbs
如果存在同名文件,则在原文件名前加"BAK_"字样。 |