关於批处理的问题

来源:百度知道 编辑:UC知道 时间:2024/05/21 07:54:10
那出问题了?
悬赏分:10 - 离问题结束还有 14 天 22 小时
Private Sub cmdCreat_Click()

Dim ImpStr As String, a As String, AllFolderPath As String, SplitCurPath() As String, tmp As String
Dim i, S As Integer

Open App.path & "\save.txt" For Input As #1

While Not EOF(1)
Line Input #1, ImpStr
If InStr(ImpStr, ".") = 0 Then
AllFolderPath = AllFolderPath & ImpStr & vbCrLf

End If
Wend
Close #1

Open App.path & "\Path.txt" For Output As #2
Print #2, AllFolderPath
SplitCurPath = Split(AllFolderPath, vbCrLf)
For i = LBound(SplitCurPath) To UBound(SplitCurPath) - 1
Print SplitCurPath(i)

Open "rd.bat" For Output As #3
Print #3, "dmdir SplitCurPath(i) /s/q"
Close #3
Shell "rd.bat", vbHide
MsgBox "成功删除"
MakeSureDirectoryPathExists SplitCurPath(i)
Next

Close #

来试试我新写的代码(也已通过调试的)

'注意:使用之前请在工程->引用对话框中点击[浏览...],输入scrrun.dll
'然后回车确认,到引用列表框里找到[Microsoft Scripting Runtime]并确认之前的框
'中打上了钩,最后确定即可。
'脚本原创:Rainbow_Route
'注意:请不要在目录名称中包含空格,否则会出错!行末文件夹字串请包含反斜杠!
'form中放一个text1,大小弄大一点,multiline设置为true,scrollbars调为2
'如果不要删除确认,可以屏蔽掉,但建议保留,以防不测
Private Declare Function MakeSureDirectoryPathExists Lib "imagehlp.dll" (ByVal DirPath As String) As Long

Private Sub cmdCreat_Click()
Text1 = ""
Dim fso As New Scripting.FileSystemObject, ImpStr As String, a As String, AllFolderPath As String, SplitCurPath() As String, tmp As String
Open App.Path & "\save.txt" For Input As #1

While Not EOF(1)
Line Input #1, ImpStr
'屏蔽小数点
If InStr(ImpStr, ".") = 0 Then
AllFolderPath = AllFolderPath & ImpStr & vbCrLf

If fso.FolderExists(ImpStr) Then
v = MsgBox("注意:检测到[" & ImpSt