一、利用批处理文件的显示内容功能给计算机的启动加密
1、方法一
既然可以在批处理文件中显示自己需要的内容,那么我们就可以让它显示一些特殊的信息,比如,计算机一启动,屏幕就显示类似如下的内容:
non-system disk or disk error
或者:
Not ready reading drive C
Abort,Retry,Fail?
如此会使非法使用者望而却步的,用记事本打开或新建Autoexec.bat,输入以下内容:
@echo off
echo non-system disk or disk error
choice /c:*/n
或者:
@echo off
echo Not ready reading drive C
echo Abort,Retry,Fail?
choice /c:*/n
存盘退出,重新启动计算机即可,如果是自己开机,可以从容地输入“*”(相当于开机密码,引号不要输入)即可让电脑继续运行,直至进入桌面。
2、方法二
我们还可以这样,让计算机启动时屏幕显示多个(80个)“_”,看上去似乎是显示器出了故障一般。
用Echo命令显示每行80个“_”(80个下划线),再用Goto命令设置一个死循环程序,以达到“屏幕花屏”的效果。
打开记事本新建C:WindowsWinstart.bat,或打开Autoexec.bat,输入以下内容:
@echo off
:abc
echo _ //“_”是英文下划线,这里只输入1个,实际输入80个“_”
goto abc
自己使用时,暂时中止的方法:按Ctrl+Break组合键,再按Y键。彻底解除中止的方法:开机按F8进入DOS,把C:WindowsWinstart.bat文件删除或把AUTOEXEC.BAT中的这些删除即可恢复。
3、方法三
利用DOS的外部命令 CHOICE的选择功能,可以起到加密作用。如果在自动批处理文件 AUTOEXEC.BAT 中加入下面一行:
C:DOSCHOICE /C:* /N
由于/n的作用,计算机启动要求输入选择项时,内容不显示在屏幕上,而是在屏幕的左上角出现一个闪动的光标,如同死机一般。只有输入 *才能启动,为避免别人用TYPE命令或文本编辑器查看而知道这个密码,可以输入一些看不见的字符,如Alt+255(小键盘)输入的假空格作为选择项。
二、巧用批处理提醒更改系统日期预防CIH病毒(转引自电脑报)
利用批处理文件显示内容的功能,建立一个防止CIH之类日期型病毒的批处理文件,用记事本打开或新建C:Autoexec.bat,输入以下内容:
rem ***** CIH and 25CIH ***** 此行为注释,不被执行
type nul>c:Today.is 建立一个临时文件Todoy.is且字节为0(空的)
cls 清屏幕
dir c: oday.is|find “-26-” 查找开机时间是否为26日
if not errorlevel 1 goto CIH 如果没有错误(是26日)就执行:CIH子程序
goto noCIH 否则(不是26日)转到:noCIH子程序
:CIH “:”是子程序的标志,“CIH”是子程序名称
echo Today is CIH day! Please change clock to 27th in the CMOS!
是26日就在屏幕上显示英文“今天是CIH日,请在CMOS中更改日期为27日” pause 暂停程序运行,并显示英文“按任意键继续”
del c: oday.is>nul 删除today.is
restart.com 执行restart.com重新启动计算机(可到Windows 98启动盘中的Ebd.cab中提取此文件)
noCIH 不是26日时执行该子程序。
以下为预防“圣诞CIH”的方法与上面的类似,不再说明,我们可以把所有病毒日都以此办法处理,只要到这样的日期,系统启动时屏幕就出现要求修改日期的提示。
cls
dir c: oday.is|find “12-25-”
if not errorlevel 1 goto 25vir
goto novir
:25vir
echo Today is CIH day! Please change clock to 27th in the CMOS!
pause
del c: oday.is>nul
restart.com
:novir
del c: oday.is>nul
rem *****CIH&25CIH*****
cls
使用:当你在每月的26日或12月25日打开电脑时,都会出现英文提示:
Today is CIH day! Please change clock to 27th in the CMOS!
按任意键将重启电脑,然后按Del键进入CMOS将日期更改为为27日即可(不要忘了到第二天再将日期改回正常日期)。注:CIH病毒是在进入Windows桌面后才进行破坏,所以把此命令加载在自动批处理文件中可以起到防止病毒破坏的作用。
三、用批处理文件代替并充实和弥补DOS命令不足
下面给出我编写的一些批处理文件内容,仅供参考:
(1)增加可执行文件路径addpath.bat
@echo off
if “%1″==””goto end
if ” %path% ==””goto next
path %path%;%1
goto end
:next
path %1
:end
或者用path1.bat
@echo off
rem path1.bat
rem 本程序的调用格式:
rem PATH1 newdir
set path=%1;%path%
也可以用 pa.bat
@set path=%path%path%path%;%1
(2)显示文件使用信息dosxx.bat
@echo off
echo exe,com文件使用信息文件
echo 格式 :dosxx *.exe(com)
echo off
for %%a in(%1) do %%a/?>>txt
(3)显示日期和时间dt.bat
@echo |more|date
@echo |more|time
(4)fm.bat
cls
cdwork
dir>ls
c:dossort<ls
del ls*
pause
c:ccedcced
(5)拷贝隐含文件hcopy.bat
@echo off
attrib -h %1
copy %1 %2
attrib +h %1
echo on
(6)删除隐含文件hdel.bat
@echo off
attrib -h %1
del %1
echo on
(7)显示隐含文件内容htype.bat
@echo off
attrib -h %1
copy/b %1 con
attrib +h %1
@echo on
(8)拷贝多个文件manycopy.bat
@echo off
ATTRIB +A *.*/S
:TOP
xcopy *.* A:/m/s>NUL
GOTO END
ECHO PUT A NEW FORMATTED BLANK DISK IN %1,THEN
PAUSE
GOTO TOP
:END
(9)同时建立多个目录md-many.bat
@for %%f in(%1 %2 %3 %4 %5 %6 %7 %8 %9)do md %%f
或者用
@echo off
if “%1″= =goto help
:next
echo md %1%
md %1
shift
if “%1″= =goto end
goto next
:help
echo 同时建立多个子目录
echo 使用格式:md-many 目录名1 目录名2…
echo 使用举例:md-many c:a d:
:end
(10)同时删除多个文件mdel.bat
@echo off
del %1
if not “%2″==””del %2
if not “%3″==””del %3
if not “%4″==””del %4
if not “%5″==””del %5
if not “%6″==””del %6
if not “%7″==””del %7
if not “%8″==””del %8
if not “%9″==””del %9
echo on
(11)同时查看多个目录mdir.bat
@echo off
if not “%1″= =””dir %1
if not “%2″= =””dir %2
if not “%3″= =””dir %3
if not “%4″= =””dir %4
if not “%5″= =””dir %5
if not “%6″= =””dir %6
if not “%7″= =””dir %7
if not “%8″= =””dir %8
if not “%9″= =””dir %9
if “%1″= =dir
echo on
(12)目录改名ml-gm.bat
@echo off
md %2
attrib -h-s/s%1*.*
xcopy %1 %2/s
deltree/y %1
(13)将任意数量的文件拷贝到一个指定的目录中 mycopy.bat
@echo off
rem mycopy.bat 的功能是将任意数量的文件拷贝到一个指定的目录中
rem 本程序的调用格式如下:
rem mycopy yourdir file1 file2 file3…
set todir=%1
:getfile
shift
if “%1%==”” goto end
copy %1 %todir%
goto getfile
:end
set todir=
echo (All done !)
(14)同时播放多个自显示图形文件 play.bat
@echo off
@pic1.exe /fad /dis /w10
@pic2.exe /fad /dis /w5
@pic3.exe /fad /dis /w5
(15)快速、彻底删除文件 qdel.bat
@echo off
@echo 删除文件qdel *.*
for %%a in (%1) do copy nul %%a>nul
(16)多个文本联接一起tlink.bat
@echo off
@echo 连接文本文件内容
@echo 格式 tlink *.*
for %%a in (%1) do type %%a>>TXT
(17)显示多个文本文件内容 typesy.bat
@echo off
rem 显示通配文本批文件内容
echo 格式:typesy *.*
for %%a in (%1) do type %%a
(18)打印多个文本 typrn.bat
@echo 打印文本文件内容
@echo 格式:typrn *.*
for %%a in (%1) do copy %%a prn
(19)隐含文件改名 wj-gm.bat
@echo off
attrib -h %1
ren %1 %2
attrib +h %1
echo on
(20)显示文本内容 xtype.bat
@echo off
copy/b %1 con
@echo on
(21)转换磁盘后直接进入目录 mcd.bat
@echo off
for %%x in(A: a: B: b: C: c: D: d: E: e:)do if %%x==%1 goto next
goto next1
:next
%1
cd
shift
:next1
cd %1
if “%1″==””goto help
goto end
:help
echo 转换磁盘与改变当前目录同时进行
echo 使用格式:mcd 盘符 路径
echo 使用举例:mcd a: bbb
:end
(22)删除多个内有各种属性文件的目录 mrd.bat
@echo off
if “%1″==””goto help
:next
echo rd %1
attrib -s -r -h %1*.*
echo ydel %1>nul
rd %1
dir %1
shift
if “%1″==””goto end
goto next
:help
echo 删除多个内有文件的目录
:end
(23)改变多个目录下的文件属性 mattrib.bat
@echo off
for %%x in (+r -r +s -s +h -h +a -a)do if %%x==%1 goto next
goto next1
:next
set sx=%1
shift
:next1
echo attrib %sx% %1
attrib %sx% %1
if “%1″==””goto end
goto next1
:help
echo 改变多个目录下的文件属性
echo 使用格式:attrib1 文件属性 目录名1 目录名2…
echo attrib1 +r dos*.* ucdos*.com
:end
set sx=
(24)多个文件同时改名 mren.bat
@echo off
if “%1″==””goto help
:next
echo ren %1 %2
ren %1 %2
shift
if “%1″==””goto end
goto next
:help
echo 多个文件同时改名
:end