【发布时间】:2012-01-24 09:54:04
【问题描述】:
我有一个 PS 脚本:
script.ps1
[System.Xml.XmlDocument] $Config;
function Get-ScriptDirectory
{
Split-Path $script:MyInvocation.MyCommand.Path
}
function Load-Config
{
$configPath = Join-Path (Get-ScriptDirectory) config.xml
$global:Config = [xml](gc $configPath)
}
Load-Config
config.xml
<Configuration>
</Configuration>
稍后在脚本中我将使用 $Config 变量。当我运行此脚本时,它会将输出写入控制台,其中包含 xml 的根元素。比如:
Configuration
--------------
有没有办法抑制这个输出?
谢谢。
【问题讨论】:
标签: powershell