powershell - 如何在 PowerShell 中将长命令拆分为多行

标签 powershell

如何在 PowerShell 中获取如下所示的命令并将其拆分为多行?

&"C:\Program Files\IIS\Microsoft Web Deploy\msdeploy.exe" -verb:sync -source:contentPath="c:\workspace\xxx\master\Build\_PublishedWebsites\xxx.Web" -dest:contentPath="c:\websites\xxx\wwwroot\,computerName=192.168.1.1,username=administrator,password=xxx"

最佳答案

尾随反引号字符,即,

&"C:\Program Files\IIS\Microsoft Web Deploy\msdeploy.exe" `
-verb:sync `
-source:contentPath="c:\workspace\xxx\master\Build\_PublishedWebsites\xxx.Web" `
-dest:contentPath="c:\websites\xxx\wwwroot,computerName=192.168.1.1,username=administrator,password=xxx"

空白很重要。所需格式为空格`Enter

关于powershell - 如何在 PowerShell 中将长命令拆分为多行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2608144/

相关文章:

powershell - "$_.extension -eq"没有按预期工作?

powershell - 使用Microsoft Graph API将文件上传到SharePoint Online

powershell - Powershell 中的 gulp-print 为空

PowerShell - 网络使用不起作用 - 变量问题

windows - 从bitvise SSH服务器控制面板导出Windows帐户列表

.net - PowerShell等效于curl HTTP POST的文件传输

c# - PowerShell 和 C# 中的 BigInt 不一致

visual-studio - 第二次运行脚本后,Powershell 无法覆盖持续错误?

powershell - 错误: Need to specify the physical directory for the virtual path 'Web/' of role

powershell - 如何通过powershell重命名azure订阅名称