如何在PowerShell中运行以下命令?
C:\Program Files\IIS\Microsoft Web Deploy\msdeploy.exe -verb:sync -source:dbfullsql="数据源=mysource;集成安全=false;用户ID=sa;Pwd=sapass!;数据库=mydb;"-dest:dbfullsql="Data Source=.\mydestsource;Integrated Security=false;User ID=sa;Pwd=sapass!;Database=mydb;",computername=10.10.10.10,username=administrator,password=adminpass"
这招对我很管用:
& 'D:\Server\PSTools\PsExec.exe' @('\\1.1.1.1', '-accepteula', '-d', '-i', $id, '-h', '-u', 'domain\user', '-p', 'password', '-w', 'C:\path\to\the\app', 'java', '-jar', 'app.jar')
只需将路径或连接字符串放在一个数组项中,并将其他内容分别分割到一个数组项中。
这里还有很多其他选项:https://social.technet.microsoft.com/wiki/contents/articles/7703.powershell-running-executables.aspx
微软应该让这种方法更简单,并与命令提示符语法兼容。
这招对我很管用:
& 'D:\Server\PSTools\PsExec.exe' @('\\1.1.1.1', '-accepteula', '-d', '-i', $id, '-h', '-u', 'domain\user', '-p', 'password', '-w', 'C:\path\to\the\app', 'java', '-jar', 'app.jar')
只需将路径或连接字符串放在一个数组项中,并将其他内容分别分割到一个数组项中。
这里还有很多其他选项:https://social.technet.microsoft.com/wiki/contents/articles/7703.powershell-running-executables.aspx
微软应该让这种方法更简单,并与命令提示符语法兼容。