Max*_*lov 6 powershell cmd.exe
我正在尝试以下 appcmd commnad:
appcmd list app /site.name:"misechko.com.ua-DEV" /xml | appcmd list vdir /in /text:physicalPath
Run Code Online (Sandbox Code Playgroud)
misechko.com.ua-DEV 是 IIS 中的正确站点名称。appcmd 注册在路径中;
当我尝试在 cmd.exe 中执行命令时,出现以下错误输出:
ERROR ( hresult:8007000d, message: The input contains an error element, 这可能表明产生输入的操作失败。)
应用程序设置中的错误是什么?我想我正在混合使用 cmd 和 powershell 方法,但是上面提到的脚本在 PowerShell 中也不起作用。通过网站名称获取路径的 PowerShell 方法是可取的。
PS 我的 PowerShell 替代方案也不起作用:
$appCmd = "$Env:SystemRoot\system32\inetsrv\appcmd.exe"
$appcmd list app /site.name:"misechko.com.ua-DEV" /xml | $appcmd list vdir /in /text:physicalPath
Run Code Online (Sandbox Code Playgroud)
谢谢!
自己研究了一下,找到了解决办法:
function GetPhysicalPath ([String]$siteName) {
function Get-PipelineInput
{
end {
[xml]$appConfigXml = $input
return $appConfigXml.application.virtualDirectory.physicalPath
}
}
$appCmd = "$Env:SystemRoot\system32\inetsrv\appcmd.exe"
return & $appCmd list app /site.name:"$siteName" /config | Get-PipelineInput
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
7534 次 |
最近记录: |