【发布时间】:2013-03-18 12:42:50
【问题描述】:
我目前正在尝试编写一个简单的批处理脚本,它将运行一系列 windows 命令并将它们很好地输出到单个 html 文件中。
例如,我正在运行的命令是netsh firewall show config,看起来像这样:
Domain profile configuration (current):
-------------------------------------------------------------------
Operational mode = Enable
Exception mode = Enable
Multicast/broadcast response mode = Enable
Notification mode = Enable
Service configuration for Domain profile:
Mode Customized Name
注意到使用的漂亮间距使其易于查看吗?
我试图将它保存在我创建的 HTML 文件中。到目前为止,我有一个简单的批处理脚本如下:
@echo off
echo ^<font face="courier new" size="2"^>^ >>index.html
netsh firewall show config >> netsh
type netsh >>index.html
当它假脱机到 index.html 文件时,结果输出如下所示:
Domain profile configuration (current): -----------------------------------------------
-------------------- Operational mode = Enable Exception mode = Enable
Multicast/broadcast response mode = Enable Notification mode = Enable Service
configuration for Domain profile: Mode Customized Name ------------------------------
------------------------------------ Enable No File and Printer Sharing Allowed\
programs configuration for Domain profile: Mode Traffic
那么有谁知道我可以如何以一种很好的方式输出命令,以便保留格式?它实际上只是一堆空格和中断。
提前感谢您的帮助!
【问题讨论】:
-
你考虑过使用 吗?
标签: html scripting batch-file cmd