Batch Processing for determining whether a USB flash drive has been inserted and all content is automatically copied-USB flash drive auto COPY

Source: Internet
Author: User
Tags echo 7

Install USB flash drive auto copy. cmd

Copy codeThe Code is as follows: @ echo off
Mode con: cols = 80 lines = 40
Color 17
: Start
Cls
Title $ * Custom * creation * $
Echo.
Echo.
Echo.
Echo.
Echo ===================================================== ==================================
Echo.
Echo.
Echo install USB flash drive automatic copy
Echo.
Welcome to echo. Please select options (1, 2, 3, 4, 5, 6)
Echo.
Echo.
Echo [1] Installer
Echo [2] run the program
Echo [3] Close the program
Echo [4] uninstall the program
Echo [5] generate shortcuts
Echo [6] Help
Echo [7] X key closed
Echo.
Echo.
Echo.
Echo prompt: if your computer has installed anti-virus software, Please authorize this VBS code!
Echo.
Echo.
Echo.
Echo.
Echo $ zookeeper manufacturing, version 1.0 $
Echo.
Echo ===================================================== ==================================
Echo.
Set/p choice = enter:
If {% choice % }={} goto start
If/I % choice % = 1 goto install
If/I % choice % = 2 goto open
If/I % choice % = 3 goto close
If/I % choice % = 4 goto uninstall
If/I % choice % = 5 goto shutcut
If/I % choice % = 6 goto help
If/I % choice % = x goto shut
Goto start

: Install
Rem ============================== installer ======== ======================================
If exist % temp % \ copy. cmd del/Q/f "% temp % \ copy. cmd"
Copy. cmd "% temp % \ copy. cmd"> nul 2> nul
Copy sleep.exe "% temp % \ sleep.exe"> nul 2> nul
Rem = ======================================
If exist % temp % \ hide. vbs del/Q % temp % \ hide. vbs
Echo.
Echo if your computer has anti-virus software installed, authorize this VBS code
Reg delete "HKEY_CLASSES_ROOT \ lnkfile"/v IsShortcut/f> nul 2> nul
Reg delete "HKEY_CLASSES_ROOT \ piffile"/v IsShortcut/f> nul 2> nul
Set path = % temp % \ copy. cmd
Echo set ws = WScript. CreateObject ("WScript. Shell")> "% temp % \ hide. vbs"
Echo ws. Run "% path %", 0> % temp % \ hide. vbs
Rem = ======================================
Echo @ echo off> % temp % \ kill. cmd
Echo mode con: cols = 20 lines = 2> % temp % \ kill. cmd
Echo program has been successfully terminated!> % Temp % \ kill. cmd
Echo pause ^> nul 2 ^> nul> % temp % \ kill. cmd
Echo tskill ping ^> nul 2 ^> nul> % temp % \ kill. cmd
Echo tskill xcopy ^> nul 2 ^> nul> % temp % \ kill. cmd
Echo tskill sleep ^> nul 2 ^> nul> % temp % \ kill. cmd
Echo tskill cmd ^> nul 2 ^> nul> % temp % \ kill. cmd
Echo exit ^> nul 2 ^> nul> % temp % \ kill. cmd
Rem = ======================================
: Shutcut
Echo.
If not exist "% temp % \ hide. vbs" goto start
Set path2 = % temp % \ hide. vbs
Echo [InternetShortcut]> USB flash drive auto copy. url
Echo URL = "% path2 %"> USB flash drive auto copy. url
Echo IconIndex = 29> USB flash drive auto copy. url
Echo IconFile = C: \ windows \ system32 \ shell32.dll> USB flash drive auto copy. url
Set path3 = % temp % \ kill. cmd
Echo [InternetShortcut]> terminate automatic copy of the USB flash drive. url
Echo URL = "% path3 %"> terminate the automatic copy of the USB flash drive. url
Echo IconIndex = 29> terminate automatic copy of the USB flash drive. url
Echo IconFile = C: \ windows \ system32 \ shell32.dll> stop USB flash drive auto copy. url
Echo completed successfully! Run the shortcut directly!
Pause> nul 2> nul
Goto start
Rem = ======================================

: Uninstall
Rem ================================== uninstall the program ======================================
Echo.
Tskill ping> nul 2> nul
Tskill xcopy> nul 2> nul
Tskill sleep> nul 2> nul
Del/Q/f "% temp % \ copy. cmd"> nul 2> nul
Del/Q/f "% temp % \ hide. vbs"> nul 2> nul
Del/Q/f "% temp % \ copy. tmp"> nul 2> nul
Del/Q/f "% temp % \ sleep.exe"> nul 2> nul
Del/Q/f "% temp % \ kill. cmd"> nul 2> nul
Del/Q/f U Disk Auto copy. url> nul 2> nul
Del/Q/f stop USB flash drive auto copy. url> nul 2> nul
The echo program has been uninstalled successfully!
Reg add "HKEY_CLASSES_ROOT \ lnkfile"/v IsShortcut/f> nul 2> nul
Reg add "HKEY_CLASSES_ROOT \ piffile"/v IsShortcut/f> nul 2> nul
Pause> nul 2> nul
Goto start
Rem ===================================================== ======================================

: Open
Rem = ======================================
Echo.
If not exist % temp % \ copy. cmd goto start
"% Temp % \ hide. vbs"
The echo program has started self-running (scanning once every 20 seconds )!
Pause> nul 2> nul
Exit
Rem = ======================================

: Close
Rem ============================ terminate the program ======================================
Echo.
If not exist % temp % \ copy. cmd goto start
The echo program has successfully completed self-running!
Pause> nul 2> nul
Tskill ping> nul 2> nul
Tskill xcopy> nul 2> nul
Tskill sleep> nul 2> nul
Tskill cmd> nul 2> nul
Exit
Rem = ======================================

: Help
Rem = ======================================
Cls
Echo.
Echo.
Echo this tool is applicable to Windows XP SP2. I am not liable for any losses caused.
Echo.
Echo.
Echo usage: 1 click to install the program
Echo.
Echo 2 if your computer has anti-virus software installed, authorize this VBS code
Echo.
Echo 3 the first installation may need to run and then take effect (depending on the system settings)
Echo.
After echo 4 is installed, start or close it in a shortcut. You do not need to start it with an installer.
Echo.
Echo 5 This program can run before the USB flash drive is inserted, or after the USB flash drive is inserted.
Echo.
Echo 6 click Run program, the program will be automatically executed every 20 seconds
Echo.
Echo 7 Make sure that your c: \ has enough space. We recommend that you do not insert a mobile hard disk when running the program.
Echo.
Echo 8 make sure that the USB flash drive you want to copy is non-toxic
Echo.
Echo 9 this program occupies memory during scanning. We recommend that you disable it after each usage.
Echo.
Echo 10 shortcut, You can rename it and place it anywhere, including the Startup Menu
Echo.
Echo 11 Please promptly clear the files in the default directory c: \ copy folder
Echo.
Echo 12 this software does not guarantee the correctness of the copy Data
Echo.
Echo 13 this software should not be used for illegal purposes
Echo.
Echo.
Echo is a free software. You are welcome to use it.
Echo.
Echo press any key to return to the main menu
Pause> nul 2> nul
Goto start
Rem ================================ help end ======== ======================================

: Shut
Rem ====================================== close the program ======================================
Exit
Rem =================================================== ======================================

Copy. cmdCopy codeThe Code is as follows: @ echo off
Title $ * Custom * creation * $
Mode con: cols = 14 lines = 1
: Again
Cls
Del/Q/f "% temp % \ copy. tmp"> nul 2> nul
For % I in (c, d, e, f, g, h, I, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z) do @ fsutil fsinfo drivetype % I:> "% temp % \ copy. tmp"
Findstr/I "Removable Drive" "% temp % \ copy. tmp"
If errorlevel = 1 goto end
If errorlevel = 0 goto copy
: End
No removable disk is detected in rem!
If not exist % temp % \ sleep.exe ping 127.0.0.1-n 20> nul 2> nul
% Temp % \ sleep.exe 20 s
Goto again
: Copy
If exist c: \ copy goto goon
Cd \
Cd/d c:
Md copy
: Goon
For/f "tokens = 1" % I in ('findstr/I "Removable Drive" "% temp % \ copy. tmp" ') do (
Xcopy/e/y % I \ *. * c: \ copy> nul 2> nul
)
Rem has been copied. Please clean up the file in time!
If not exist % temp % \ sleep.exe ping 127.0.0.1-n 20> nul 2> nul
% Temp % \ sleep.exe 20 s
Goto again

File Packaging

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.