VBS实现一个过去的需求

MoveTXT "C:\Develop\Windows Dev","C:\Develop\Windows Dev\Process\"

Function MoveTXT(sSource, sTarget)
Set fso = CreateObject("Scripting.FileSystemObject")
For Each file in fso.GetFolder(sSource).Files
 If fso.GetExtensionName(file) = "trg" Then
  txtFile = sSource & "\" & fso.GetBaseName(file) & ".txt"
  If fso.FileExists(txtFile) Then
   fso.MoveFile txtFile,sTarget
   fso.DeleteFile sSource & "\" & fso.GetBaseName(file) & ".trg"
  End If
 End If
Next
End Function

你可能感兴趣的:(vbs)