windows批处理文件脚本-保留html格式

windows批处理文件脚本-保留html格式,html,scripting,batch-file,cmd,Html,Scripting,Batch File,Cmd,我目前正在尝试编写一个简单的批处理脚本,它将运行一系列windows命令,并将它们很好地输出到单个html文件中 例如,im运行的命令是netsh firewall show config,看起来如下所示: Domain profile configuration (current): ------------------------------------------------------------------- Operational mode = En

我目前正在尝试编写一个简单的批处理脚本,它将运行一系列windows命令,并将它们很好地输出到单个html文件中

例如,im运行的命令是
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
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文件中。到目前为止,我有一个简单的批处理脚本,如下所示:

@echo off

echo ^<font face="courier new" size="2"^>^ >>index.html
netsh firewall show config >> netsh
type netsh >>index.html
那么,有人知道我如何以一种好的方式输出命令,以便保留格式吗?它实际上只是一堆空格和空格

提前感谢您的帮助

使用标记保留文本布局:

@echo关闭
echo^>>index.html
netsh防火墙显示配置>>index.html
echo^>>index.html
您是否考虑过使用?
@echo off
echo ^<pre^> >>index.html
netsh firewall show config >> index.html
echo ^</pre^> >>index.html