Код:
format PE GUI 4.0
include '%fasminc%/win32a.inc'
section '.code' code readable writeable executable
fmt db "%s %ws",0
szfile db "12345.bat",0
entry $
;получить и разделить аргументы
invoke GetCommandLineW
push eax
invoke CommandLineToArgvW, eax, esp
lea esi,[eax+4]
pop edi
;выделить строку под склеенные аргументы
invoke VirtualAlloc,0,1000h,MEM_COMMIT+MEM_RESERVE,PAGE_READWRITE
mov ebx,eax
test eax,eax
jz .exit
;склеить аргументы(кроме нулевого)
@@:
sub edi,1
jz @f
lodsd
cinvoke _snprintf,ebx,1000h,fmt,ebx,eax
jmp @b
@@:
;сздать батник
add ebx,1
sub esp,sizeof.OFSTRUCT
invoke OpenFile,szfile,esp,OF_CREATE
mov esi,eax
add esp,sizeof.OFSTRUCT
;записать туда строку
invoke lstrlen,ebx
invoke WriteFile,esi,ebx,eax,esp,0
invoke CloseHandle,esi
;запустить
invoke WinExec,szfile,SW_HIDE
invoke VirtualFree,ebx,0,MEM_RELEASE
;удалить
invoke DeleteFile,szfile
.exit:
invoke ExitProcess,0
data import
library kernel32,'KERNEL32.DLL',\
kernel32w,'KERNEL32.DLL',\
user32,'USER32.DLL',\
shell32,'shell32.dll',\
ntdll,'ntdll.dll'
include '%fasminc%\apia\comdlg32.inc'
include '%fasminc%\apia\user32.inc'
include '%fasminc%\apia\kernel32.inc'
import shell32,\
CommandLineToArgvW,'CommandLineToArgvW'
import kernel32w,\
GetCommandLineW,'GetCommandLineW'
include '%fasminc%\ntdll.inc'
end data