728x90
반응형
728x170
▶ Process 클래스 : 명령줄 구하기 예제
using System.Diagnostics;
Process process = Process.GetCurrentProcess();
string commandLine = GetCommandLine(process);
728x90
▶ Process 클래스 : 명령줄 구하기
using System.Diagnostics;
using System.Management;
using System.Text;
#region 명령줄 구하기 - GetCommandLine(process)
/// <summary>
/// 명령줄 구하기
/// </summary>
/// <param name="process">프로세스</param>
/// <returns>명령줄</returns>
private static string GetCommandLine(Process process)
{
StringBuilder stringBuilder = new StringBuilder();
using
(
ManagementObjectSearcher searcher = new ManagementObjectSearcher
(
"SELECT CommandLine FROM Win32_Process WHERE ProcessId = " + process.Id
)
)
{
foreach(ManagementBaseObject baseObject in searcher.Get())
{
stringBuilder.Append(baseObject["CommandLine"]);
stringBuilder.Append(" ");
}
}
string commandLine = stringBuilder.ToString().Trim();
return commandLine;
}
#endregion
728x90
반응형
그리드형(광고전용)
'C# > Common' 카테고리의 다른 글
[C#/COMMON] gacutil.exe 프로그램 : 어셈블리 등록하기 (0) | 2017.10.27 |
---|---|
[C#/COMMON] MIDI 출력 장치 설정하기 (0) | 2017.10.01 |
[C#/COMMON] Typed DataTable 사용하기 (0) | 2017.10.01 |
[C#/COMMON] AutoResetEvent 클래스 사용하기 (0) | 2017.10.01 |
[C#/COMMON] CollectionBase 클래스 : OnInsert 및 OnInsertComplete 메소드 사용하기 (0) | 2017.10.01 |
[C#/COMMON] 방화벽 설정하기 (0) | 2017.07.17 |
[C#/COMMON] 방화벽 TCP 포트 열기/닫기 (0) | 2017.07.09 |
[C#/COMMON] 네트워크 어댑터 활성화/비활성화 하기 (0) | 2017.07.09 |
[C#/COMMON] Ping 클래스 : 인터넷 연결 여부 구하기 (0) | 2017.07.09 |
[C#/COMMON] 인터넷 연결하기/연결끊기 (0) | 2017.07.09 |
댓글을 달아 주세요