本帖最后由 小文 于 2015-2-15 19:38 编辑
- set a="@echo off"
- set b="ping 127.0.0.1 -n 5000>unl"
- set c="pause"
- echo %a% %b% %c%>null.bat
- pause
复制代码 我在网上找了三四种bat延迟执行的方法,但它们都只能在转行的情况下执行,如【ping 127.0.0.1 -n 5000>unl】、【for /l %%i in (0,1,10000) do echo %%i>nul】。
【dir c:\ & timeout /t 10 & dir d:\ 】可在本行执行,但无法通过直接输出到生成的文件(而是在“变量中就直接执行了”)、- :: Sleep.bat - Sleep/Delay/Wait n seconds:: Herbert Kleebauer(Germany) - 2005/05/29
- :: Modified by Will Sort - 2005/06/02
- @echo off
- echo q | debug>nul
- echo Bj@jzh`0X-`/PPPPPPa(DE(DM(DO(Dh(Ls(Lu(LX(LeZRR]EEEUYRX2Dx=>sleep.com
- echo 0DxFP,0Xx.t0P,=XtGsB4o@$?PIyU WwX0GwUY Wv;ovBX2Gv0ExGIuht6>>sleep.com
- echo T}{z~~@GwkBG@OEKcUt`~}@MqqBsy?seHB~_Phxr?@zAB`LrPEyoDt@Cj?>>sleep.com
- echo pky_jN@QEKpEt@ij?jySjN@REKpEt@jj?jyGjN@SEKkjtlGuNw?p@pjirz>>sleep.com
- echo LFvAURQ?OYLTQ@@?~QCoOL~RDU@?aU?@{QOq?@}IKuNWpe~FpeQFwH?Vkk>>sleep.com
- echo _GSqoCvH{OjeOSeIQRmA@KnEFB?p??mcjNne~B?M??QhetLBgBPHexh@e=>>sleep.com
- echo EsOgwTLbLK?sFU`?LDOD@@K@xO?SUudA?_FKJ@N?KD@?UA??O}HCQOQ??R>>sleep.com
- echo _OQOL?CLA?CEU?_FU?UAQ?UBD?LOC?ORO?UOL?UOD?OOI?UgL?LOR@YUO?>>sleep.com
- echo dsmSQswDOR[BQAQ?LUA?_L_oUNUScLOOuLOODUO?UOE@OwH?UOQ?DJTSDM>>sleep.com
- echo QTqrK@kcmSULkPcLOOuLOOFUO?hwDTqOsTdbnTQrrDsdFTlnBTm`lThKcT>>sleep.com
- echo @dmTkRQSoddTT~?K?OCOQp?o??Gds?wOw?PGAtaCHQvNntQv_w?A?it\EH>>sleep.com
- echo {zpQpKGk?Jbs?FqokOH{T?jPvP@IQBDFAN?OHROL?Kj??pd~aN?OHROd?G>>sleep.com
- echo Q??PGT~B??OC~?ipO?T?~U?p~cUo0x>>sleep.com
- sleep.com>sleep.exe
- del sleep.com
- echo wait 2 seconds:
- sleep.exe 2000
复制代码 我就不知道了……
需要讨论的有:输出后能延迟执行(也可通过加引号完整输出,再删除生成的引号,但有没有更好的办法呢?);
输出后的换行问题(我大概在网上查了下,本问题貌似不好解决)。 |