2015-08-29 56 views
2

爲了教育的原因,我製作了一個使用批處理的測試蠕蟲,但是在創建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 

回答

1

注意,在命令集和蒂爾達修飾符
和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" 
+0

我回顧了讓腳本獲得管理員的東西,然後我發現它運行了兩次:P感謝您的回答,但它使我的腳本更好! – face5054

相關問題