【发布时间】:2015-07-16 12:04:30
【问题描述】:
我有以下 XML 格式
如何读取Tar Path的值
<?xml version="1.0" encoding="utf-8"?>
<Foo xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Bar Path="c:\program files\bar" />
<Tar Path="c:\program files\tar" Include="All" />
<Updates></Updates>
</Foo>
在本例中,我需要接收值:c:\program files\tar
根据 Alex 的评论,也可以在 PowerShell 脚本中执行此操作。
我需要将这段代码添加到现有的 .cmd 文件中,是否可以从 .cmd 调用 PowerShell 脚本并将结果返回给 cmd?
【问题讨论】:
-
建议使用除批处理/cmd 以外的任何东西
-
没错,但不幸的是我需要 cmd 批处理
-
vbscript、jscript、powershell?全部从命令行运行
-
这个想法是我想从现有的 .cmd 文件运行代码,是否可以从 .cmd 调用 powershell 脚本并将结果返回给我的 cmd?你能分享一个代码示例吗
标签: xml windows powershell cmd