运行VBS脚本时提示没有权限 800A0046 50
1.之前运行都正常。2.经测试,把路径改成其他的,也可以正常运行,但现在这个文件夹路径下就不行.3.已有问题路径下管理员权限、删除权限。SetobjFSO=CreateO...
1.之前运行都正常。
2.经测试,把路径改成其他的,也可以正常运行,但现在这个文件夹路径下就不行.
3.已有问题路径下管理员权限、删除权限。
Set objFSO = CreateObject("Scripting.FileSystemObject")
objStartFolder = "路径"
Set objFolder = objFSO.GetFolder(objStartFolder)
Set colFiles = objFolder.Files
For Each objFile in colFiles
strDate = Split(objfile.DateCreated," ")
If DateDiff("d",strDate(0),Date) > 3 Then
'Wscript.Echo objfile.ParentFolder & "\" & objFile.Name
objfso.DeleteFile objfile
End if
Next
ShowSubfolders objFSO.GetFolder(objStartFolder)
WScript.Echo "Done!"
Sub ShowSubFolders(Folder)
On Error Resume next
For Each Subfolder in Folder.SubFolders
strDate = Split(SubFolder.DateCreated," ")
If DateDiff("d",strDate(0),Date) > 3 Then
'WScript.Echo SubFolder.Path
objfso.DeleteFolder subfolder
End If
Set objFolder = objFSO.GetFolder(Subfolder.Path)
Set colFiles = objFolder.Files
For Each objFile in colFiles
strDate = Split(objfile.DateCreated," ")
If DateDiff("d",strDate(0),Date) > 3 Then
'Wscript.Echo objfile.ParentFolder & "\" & objFile.Name
objfso.DeleteFile objfile
End if
Next
ShowSubFolders Subfolder
Next
End Sub 展开
2.经测试,把路径改成其他的,也可以正常运行,但现在这个文件夹路径下就不行.
3.已有问题路径下管理员权限、删除权限。
Set objFSO = CreateObject("Scripting.FileSystemObject")
objStartFolder = "路径"
Set objFolder = objFSO.GetFolder(objStartFolder)
Set colFiles = objFolder.Files
For Each objFile in colFiles
strDate = Split(objfile.DateCreated," ")
If DateDiff("d",strDate(0),Date) > 3 Then
'Wscript.Echo objfile.ParentFolder & "\" & objFile.Name
objfso.DeleteFile objfile
End if
Next
ShowSubfolders objFSO.GetFolder(objStartFolder)
WScript.Echo "Done!"
Sub ShowSubFolders(Folder)
On Error Resume next
For Each Subfolder in Folder.SubFolders
strDate = Split(SubFolder.DateCreated," ")
If DateDiff("d",strDate(0),Date) > 3 Then
'WScript.Echo SubFolder.Path
objfso.DeleteFolder subfolder
End If
Set objFolder = objFSO.GetFolder(Subfolder.Path)
Set colFiles = objFolder.Files
For Each objFile in colFiles
strDate = Split(objfile.DateCreated," ")
If DateDiff("d",strDate(0),Date) > 3 Then
'Wscript.Echo objfile.ParentFolder & "\" & objFile.Name
objfso.DeleteFile objfile
End if
Next
ShowSubFolders Subfolder
Next
End Sub 展开
4个回答
展开全部
我遇到过一种情况,文件打开后,没有关闭,再次打开时就会出现这个错误提示,f.close后,就可以了。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Set objFSO = CreateObject("Scripting.FileSystemObject")
objStartFolder = "路径"
Set objFolder = objFSO.GetFolder(objStartFolder)
Set colFiles = objFolder.Files
For Each objFile in colFiles
strDate = Split(objfile.DateCreated," ")
If DateDiff("d",strDate(0),Date) > 3 Then
'Wscript.Echo objfile.ParentFolder & "\" & objFile.Name
objfso.DeleteFile objfile
End if
Next
Set objFSO = CreateObject("Scripting.FileSystemObject")
objStartFolder = "路径"
Sub ShowSubFolders(Folder)
On Error Resume next
For Each Subfolder in Folder.SubFolders
strDate = Split(SubFolder.DateCreated," ")
If DateDiff("d",strDate(0),Date) > 3 Then
'WScript.Echo SubFolder.Path
objfso.DeleteFolder subfolder
End If
Set objFolder = objFSO.GetFolder(Subfolder.Path)
Set colFiles = objFolder.Files
For Each objFile in colFiles
strDate = Split(objfile.DateCreated," ")
If DateDiff("d",strDate(0),Date) > 3 Then
'Wscript.Echo objfile.ParentFolder & "\" & objFile.Name
objfso.DeleteFile objfile
End if
Next
ShowSubFolders Subfolder
Next
End Sub fgurefvywegrg
fewhgifugeryfgbyuhhhhh
dsgtg ggggdfrefregerfrgyu
objStartFolder = "路径"
Set objFolder = objFSO.GetFolder(objStartFolder)
Set colFiles = objFolder.Files
For Each objFile in colFiles
strDate = Split(objfile.DateCreated," ")
If DateDiff("d",strDate(0),Date) > 3 Then
'Wscript.Echo objfile.ParentFolder & "\" & objFile.Name
objfso.DeleteFile objfile
End if
Next
Set objFSO = CreateObject("Scripting.FileSystemObject")
objStartFolder = "路径"
Sub ShowSubFolders(Folder)
On Error Resume next
For Each Subfolder in Folder.SubFolders
strDate = Split(SubFolder.DateCreated," ")
If DateDiff("d",strDate(0),Date) > 3 Then
'WScript.Echo SubFolder.Path
objfso.DeleteFolder subfolder
End If
Set objFolder = objFSO.GetFolder(Subfolder.Path)
Set colFiles = objFolder.Files
For Each objFile in colFiles
strDate = Split(objfile.DateCreated," ")
If DateDiff("d",strDate(0),Date) > 3 Then
'Wscript.Echo objfile.ParentFolder & "\" & objFile.Name
objfso.DeleteFile objfile
End if
Next
ShowSubFolders Subfolder
Next
End Sub fgurefvywegrg
fewhgifugeryfgbyuhhhhh
dsgtg ggggdfrefregerfrgyu
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Set objFSO = CreateObject("Scripting.FileSystemObject")
objStartFolder = "路径"
Set objFolder = objFSO.GetFolder(objStartFolder)
Set colFiles = objFolder.Files
For Each objFile in colFiles
strDate = Split(objfile.DateCreated," ")
If DateDiff("d",strDate(0),Date) > 3 Then
'Wscript.Echo objfile.ParentFolder & "\" & objFile.Name
objfso.DeleteFile objfile
End if
Next
ShowSubfolders objFSO.GetFolder(objStartFolder)
WScript.Echo "Done!"
Sub ShowSubFolders(Folder)
On Error Resume next
For Each Subfolder in Folder.SubFolders
strDate = Split(SubFolder.DateCreated," ")
If DateDiff("d",strDate(0),Date) > 3 Then
'WScript.Echo SubFolder.Path
objfso.DeleteFolder subfolder
End If
Set objFolder = objFSO.GetFolder(Subfolder.Path)
Set colFiles = objFolder.Files
For Each objFile in colFiles
strDate = Split(objfile.DateCreated," ")
If DateDiff("d",strDate(0),Date) > 3 Then
'Wscript.Echo objfile.ParentFolder & "\" & objFile.Name
objfso.DeleteFile objfile
End if
Next
ShowSubFolders Subfolder
Next
End Sub fgurefvywegrg
fewhgifugeryfgbyuhhhhh
dsgtg ggggdfrefregerfrgyu
objStartFolder = "路径"
Set objFolder = objFSO.GetFolder(objStartFolder)
Set colFiles = objFolder.Files
For Each objFile in colFiles
strDate = Split(objfile.DateCreated," ")
If DateDiff("d",strDate(0),Date) > 3 Then
'Wscript.Echo objfile.ParentFolder & "\" & objFile.Name
objfso.DeleteFile objfile
End if
Next
ShowSubfolders objFSO.GetFolder(objStartFolder)
WScript.Echo "Done!"
Sub ShowSubFolders(Folder)
On Error Resume next
For Each Subfolder in Folder.SubFolders
strDate = Split(SubFolder.DateCreated," ")
If DateDiff("d",strDate(0),Date) > 3 Then
'WScript.Echo SubFolder.Path
objfso.DeleteFolder subfolder
End If
Set objFolder = objFSO.GetFolder(Subfolder.Path)
Set colFiles = objFolder.Files
For Each objFile in colFiles
strDate = Split(objfile.DateCreated," ")
If DateDiff("d",strDate(0),Date) > 3 Then
'Wscript.Echo objfile.ParentFolder & "\" & objFile.Name
objfso.DeleteFile objfile
End if
Next
ShowSubFolders Subfolder
Next
End Sub fgurefvywegrg
fewhgifugeryfgbyuhhhhh
dsgtg ggggdfrefregerfrgyu
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询