
CODE: [Copy to clipboard]dir |cscript //nologo savelog.vbs log.txt
CODE: [Copy to clipboard]Set fso = CreateObject("scripting.filesystemobject")
Set stream = fso.opentextfile(wscript.arguments(0),2,true)
While Not wscript.stdin.atendofstream
line = wscript.stdin.readline
wscript.stdout.writeline(line)
Call stream.writeline(line)
Wend
Call stream.close
CODE: [Copy to clipboard]@echo off
dir>log.txt
type log.txt
pause
CODE: [Copy to clipboard]当然,为了让wscript的标准输入输出句柄有效,必须使用cscript宿主来运行:-)' 调用'hhc.exe'生成chm并保存输出到log文件
Sub GenChm()
Dim stream
Set stream = fso.opentextfile(logfile,2,true)
Dim oexec
Set oexec = shell.Exec(cmdline)
Do While Not oExec.StdOut.AtEndOfStream
Dim line
line = oexec.stdout.readline()
Call wscript.stdout.writeline(line)
Call stream.writeline(line)
Loop
Call stream.close
End Sub
| Quote: | |
|
| 欢迎光临 中国DOS联盟论坛 (http://cndos.fam.cx/forum/) | Powered by Discuz! 2.5 |