728x90
반응형
728x170
▶ Process 클래스 : PowerShell 스크립트 파일 실행하기 예제
string scriptFilePath = @"d:\PowerShell Script\script.ps1";
ExecutePowerShellScriptFile(scriptFilePath);
728x90
▶ Process 클래스 : PowerShell 스크립트 파일 실행하기
using System.Diagnostics;
#region PowerShell 스크립트 파일 실행하기 - ExecutePowerShellScript(scriptFilePath)
/// <summary>
/// PowerShell 스크립트 파일 실행하기
/// </summary>
/// <param name="scriptFilePath">스크립트 파일 경로</param>
public void ExecutePowerShellScriptFile(string scriptFilePath)
{
ProcessStartInfo processStartInfo = new ProcessStartInfo()
{
FileName = "powershell.exe",
Arguments = $"-NoProfile -ExecutionPolicy unrestricted -File \"{scriptFilePath}\"",
UseShellExecute = false
};
Process.Start(processStartInfo);
}
#endregion
728x90
반응형
그리드형(광고전용)
'C# > Common' 카테고리의 다른 글
[C#/COMMON] Process 클래스 : Start 정적 메소드를 사용해 장치 및 프린터 대화 상자 표시하기 (0) | 2021.02.23 |
---|---|
[C#/COMMON] 카메라 정보 조회하기 (0) | 2021.02.23 |
[C#/COMMON] Process 클래스 : 프로세스 파일 경로 구하기 (0) | 2021.02.23 |
[C#/COMMON] USB 케이블 연결 카메라에서 사진 파일 복사하기 (0) | 2021.02.22 |
[C#/COMMON] 누겟 설치 : MediaDevices (0) | 2021.02.22 |
[C#/COMMON] Process 클래스 : PowerShell 스크립트 실행하기 (0) | 2021.02.22 |
[C#/COMMON] Runspace 클래스 : PowerShell 스크립트 실행하기 (0) | 2021.02.22 |
[C#/COMMON] 극 좌표(Polar Coordinates) 사용하기 (0) | 2021.02.14 |
[C#/COMMON] 3자 컴포넌트 어셈블리 서명하기 (0) | 2021.02.08 |
[C#/COMMON] 반복자(Iterator)를 사용해 텍스트 파일 반대로 읽기 (0) | 2021.02.08 |
댓글을 달아 주세요