收藏了很久的一个批处理,很不错,如果你有一个N大的邮箱却不能使用附件的话,尝试这个吧,转成批处理后再复制进去,到其他地方再复制出来运行就可以了@echo off::::::::Any2Bat {s11ss 2007-12-2}::::::::::思路:利用debug获得原文件16进制代码,然后再次利用debug构造生成原文件的bat代码。setlocalset f="%~f1"if not exist %f% (echo File doesn't exist!&&goto :eof)::写临时文件set len=%~z1set/a end=0x100+%len%-1call :10to16 %end%pushd %tmp%>t1 call echo d100 %%r%end%%%>>t1 echo q>nul copy %f% t2type t1|debug t2|more|find ":">t3::读取临时文件t3,获得16进制代码set "i= %%a %%b %%c %%d %%e %%f %%g %%h %%i %%j %%k %%l %%m %%n %%o %%p %%q"for /f "delims=" %%a in (t3) do set/a lines+=1set/a m=1setlocal enabledelayedexpansionfor /f "tokens=1-17 delims=- " %%a in (t3) do ( if !m! equ %lines% goto :lastline set "hex!m!=%i%" set/a m+=1):lastlineset/a m-=1set/a remain=(%len%-16*%m%+1)*3call set remain=%%i:~0,%remain%%%for /f "tokens=1-17 delims=- " %%a in ('^<t3 more +%m%') do set "hex%lines%=%remain%"::写batcall :10to16 %len%set t=^>^>%f%.bat echo%t% @echo off%t% ^<^"%%^~f0^" more +4 ^|debug ^>nul%t% move t "%~nx1"%t% goto :eoffor /l %%a in (1,1,%lines%) do ( call set hex%%a=%%hex%%a:*:=e%% %t% !hex%%a!)%t% rcx%t% !r%len%!%t% n t%t% w%t% qfor /l %%a in (1,1,3) do (del t%%a)goto :eof:10to16set "h=0123456789ABCDEF"set/a q=%1 :1c set/a r=%q%%%16 set/a q=%q%/16 call set r=%%h:~%r%,1%% call set r%1=%r%%%r%1%%if not %q% equ 0 goto :1c 转载请注明:鸟儿博客 » ANY2BAT代码