に異なる出力を生成します。私はそれをデバッグのときPowerShellスクリプトは、私がPSで次のスクリプトを持ってPowerguiブロックとPowerShellのコンソール
<Deploy>
<SourceFolder>C:\FolderPath</SourceFolder>
<Deploy>
:
[System.Xml.XmlDocument] $Config;
function Get-ScriptDirectory
{
Split-Path $script:MyInvocation.MyCommand.Path
}
function LoadConfig
{
$configPath = Join-Path (Get-ScriptDirectory) Config.xml
$Config = [xml](gc $configPath)
}
function WriteData
{
$sourceFolderPath = $Config.Deploy.SourceFolder
Write-Host $sourceFolderPath
}
LoadConfig
WriteData
私の基本的なxmlファイルは次のようになりますPowerGUIツールは正常に動作し、正しい出力を書き込みます。しかし、Windows 7のPowerShellコンソールで同じスクリプトを実行すると、空の行になります。なぜ私は考えていない。
「$ configPath」は常に同じですか? – stej
はいです。私はそれを解決した。以下の答えを参照してください。 – zosim