【发布时间】:2019-01-24 10:27:49
【问题描述】:
当我通过命令窗口运行时,Powershell 脚本运行良好。但是通过asp.net网页却没有。任何人都可以提供故障排除的指示...运行 Windows 10
using System.Management.Automation;
using System.Management.Automation.Runspaces;
Runspace runspace = RunspaceFactory.CreateRunspace();
runspace.Open();
Pipeline pipeline = runspace.CreatePipeline();
pipeline.Commands.AddScript("powershell.exe -ExecutionPolicy Unrestricted -file D:\\Files\\Scripts\\Script20180817.ps1 -FilePath " + file);
pipeline.Invoke();
runspace.Close();
【问题讨论】:
标签: c# asp.net powershell