文件名未显示在cmd中

时间:2011-03-02 02:11:20

标签: powershell

我有以下代码段

$svc_Files = gci | Where {$_.extension -eq ".svc"}
write-host "Building WSDL ..."
$cmd_svc = "`"C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\x64\SvcUtil.exe`"" 
Foreach ($svc_File in $svc_Files) 
{
    write-host "& $cmd_svc http://id.web/Services/$svc_File?wsdl"
}

问题是文件名没有显示。但是,一旦我删除“?wsdl”,就会显示文件名。

如何在末尾以“?wsdl”显示文件名?

2 个答案:

答案 0 :(得分:3)

  write-host "& $cmd_svc http://id.web/Services/${svc_File}?wsdl"

答案 1 :(得分:2)

试试这个:

write-host "& $cmd_svc http://id.web/Services/$svc_File`?wsdl"

你也可以这样做:

write-host“& $ cmd_svc http://id.web/Services/ $($ svc_File)?wsdl”