我出于教育原因使用批处理制作了一个测试蠕虫,但代码中有一个错误,它创建了2个文件夹,但它只将文件复制到其中一个文件夹中,并且它们也有不同的文件夹名称。我试图调试,但搜索后,额外的文件夹以某种方式外部添加。
::there was a small script to get admin, but i dont think
::that was important, so i edited it out.
::::::::::::::: PARAMS
if EXIST Worm.bat (
echo test5
)
::Make sure that CD stays CD
set CDS=%cd%
set ver=0.01
set file=%0
set fln=%0.bat
echo test
set fil=%fil%%ver%%random%
set file=%fil%
:::::::::::::: PARAMS
::@echo off
title ~~WinWormSELFxTractor%ver%~~
echo WELCOME TO HELL
mkdir "%file%"
copy "%CDS%\%fln%" "%file%\Worm.bat"
cd %file%
::copy %0.bat
答案 0 :(得分:1)
请注意set命令和tilda修饰符中添加的双引号 并且cd命令已更改。
测试它是否符合你的要求。
::::::::::::::: PARAMS
if EXIST Worm.bat (
echo test5
)
::Make sure that CD stays CD
set "CDS=%cd%"
set "ver=0.01"
set "file=%~0"
set "fln=%~n0.bat"
echo test
set "fil=%fil%%ver%%random%"
set "file=%fil%"
:::::::::::::: PARAMS
::@echo off
title ~~WinWormSELFxTractor%ver%~~
echo WELCOME TO HELL
mkdir "%file%"
copy "%CDS%\%fln%" "%file%\Worm.bat"
cd /d "%file%"
::copy "%~n0.bat"