我曾经在Windows 7 Professional中使用以下脚本通过读取文本文件来移动文件,该文本文件在一行上具有每个文件的完整路径。 现在,当我在Windows 10中运行它时,它说“处理完成”, 但没有任何反应,也不会给出任何错误信息。 怎么了?
Const ForReading = 1
Dim theSourceFile
Dim theDestinationFolder
'######CHANGE THESE TWO LINES BELOW ONLY!!!!######
theSourceFile = "C:\Users\joe\Documents\move.txt"
theDestinationFolder = "C:\Users\joe\Documents\TEST\"
'#################################################
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile _
(theSourceFile, ForReading)
'Read the text file line by line for the filename
Do Until objTextFile.AtEndOfStream
theFiletoMove = objTextFile.ReadLine
'If the file exists then move it using the same file name
'to the new location
If objFSO.FileExists(theFileToMove) Then
objFSO.MoveFile theFileToMove, theDestinationFolder
End If
Loop
objTextFile.Close
msgbox "Process completed."