仅请求一个文件夹时创建两个文件夹[批量]

Makes two folders when only one is requested [Batch]

出于教育原因,我使用批处理制作了一个测试蠕虫,但代码中某处存在错误,它创建了 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

注意 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"