當執行以下腳本(這是實際腳本的一部分)時,出現以下錯誤消息在PowerShell中:術語'xsd'不被識別爲cmdlet,函數,腳本文件或可操作程序的名稱
The term 'xsd' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:10 char:3
$xsds = ls *.xsd | %{ $_.Name }
if ($xsds.Count -eq 0) { exit }
# Add '.\' to last file name, see http://stackoverflow.com/questions/906093/xsd-exe-output-filename
$last = $xsds | select -last 1
$last = '.\' + $last
$xsds[$xsds.Count - 1] = $last
& xsd $xsds /c /n:OutputFolder
是否有PowerShell的一些要求,我需要安裝能夠先運行「XSD」 cmdlet的?
的$env:Path
輸出:
PS C:\Users\Administrator\Desktop\New> $env:Path
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Mi
crosoft\Web Platform Installer\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;C:\Program Files
(x86)\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Micro
soft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\;C:\Program F
iles (x86)\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\
PS C:\Users\Administrator\Desktop\New>
的xsd.exe
可以在文件夾:
C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools
C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\x64
XSD是否是您的系統上某個exe文件?您可以檢查'$ env:Path'來查看該路徑是否存在。 XSD不是我熟悉的powershell cmdlet。 – Matt 2014-11-01 19:45:45
@Matt我在帖子中添加了請求的信息。 – SeToY 2014-11-01 19:51:31
'xsd'不是一個cmdlet。就像錯誤信息告訴你的一樣。嘗試相信錯誤信息。 – 2014-11-01 19:55:43