我有一个启动powershell作业的脚本,其中包含一个包含c#代码的脚本块。
现在我有一个睡眠命令,允许代码正确地摆出自己的姿势,但一个更干净的方法(如果可能的话)是让psjob c#代码设置一个标志,让我的其余代码尽快启动,而不是等待5秒的睡眠。这个是可能的吗?
$containerScript = {a mix of c# and powershell}
Start-Job -ScriptBlock $containerScript ;
sleep 5; # wait here for c# code to set up
Connect-MsolService;
所以,如果我在c#的ps
我试图通过cmd运行一个带有多个字符串参数的powershell命令。
上下文是,我想使用Compress-Archive函数/脚本中的Matlab。而Matlab只能访问cmd。
但是,当在cmd中调用powershell.exe时,我找不到一种方法来保留字符串参数中的连续空格。
C:\Users\Artus>powershell.exe echo 'a c'
a c
C:\Users\Artus>powershell.exe echo \"a c\"
a c
C:\Users\Artus>powershell.exe echo