本帖最后由 CrLf 于 2014-11-28 04:08 编辑
回复 21# amwfjhh
关于比较通用的 vbs 和 bat 混编,在“不生成新文件”的前提下,以前想了两种擦边的办法
1,临时改后缀名为 wsf,或者把宿主修改成可以认其他后缀名:http://bbs.bathome.net/viewthread.php?tid=29918- :<!--
- @echo off
- (
- move /y "%~0" "%~n0.wsf" >nul
- for /f "delims=" %%a in ('cscript -nologo "%~n0.wsf"') do (
- echo 昨天是 %%a
- )
- ren "%~n0.wsf" "%~nx0" >nul
- )
- pause&exit/b
- -->
-
- <package><job id="vbs"><script language="vbscript">
- WScript.Echo Now-1
- </script></job></package>
复制代码 2、输出到流文件- @echo off
- more +7 "%~0">"%~0:haha.vbs"
- for /f "delims=" %%a in ('cscript -nologo "%~0:haha.vbs"') do (
- echo 昨天是 %%a
- )
- pause&exit/b
-
- WScript.Echo Now-1
复制代码 但都不理想,这么折腾还不如分成两个文件 |