forked from DoctorLai/BatchUtils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautorun.bat
34 lines (27 loc) · 804 Bytes
/
autorun.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
@echo off
rem A Batch Script to Create Folder 'autorun.inf'
rem This can prevent autorun.inf virus.
rem Free to use, put at startup recommended.
rem by Zhihua Lai, 2 - Dec - 2008
for %%i in (A B 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 call :sub %%i
goto end
:sub
echo Checking %1: ...
if not exist %1:\nul goto notfound
if exist %1:\autorun.inf\nul goto already
if exist %1:\autorun.inf goto clean
goto done
:clean
echo removing File %1:\autorun.inf ...
attrib -r -a -s -h %1:\autorun.inf
del %1:\autorun.inf
:done
echo Making directory '%1:\autorun.inf' ...
mkdir %1:\autorun.inf
:already
echo Attributing directory '%1:\autorun.inf' ...
attrib +r +a +s +h %1:\autorun.inf
goto end
:notfound
echo Skipping %1: ...
:end