【发布时间】:2014-11-01 19:30:14
【问题描述】:
执行以下脚本时(这是实际脚本的一部分),我在 powershell 中收到以下错误消息:
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 我已将请求的信息添加到帖子中。
-
xsd不是 cmdlet。就像错误消息告诉你的一样。尝试相信错误信息。
标签: powershell xsd powershell-cmdlet