-
Notifications
You must be signed in to change notification settings - Fork 66
Запуск процесса с правами администратора #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| Process process = new Process(); | ||
| process.StartInfo.FileName = "cmd"; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. не ясно почему запускаем cmd если я правильно понял |
||
| process.StartInfo.Arguments = "/c for /F \"tokens=*\" %1 in ('wevtutil.exe el') DO wevtutil.exe cl \"%1\""; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. не ясно что это за аргументы |
||
| process.StartInfo.Verb = "runas"; // запуск с правами администратора | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Было бы хорошо, если тут ещё написать как без прав админа запускать (чтоб могли протестировать с ними или без если у кого-то будут проблемы при запуске чего-то)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Нужно бы определиться, для примеров что запускать, у чего есть параметры запуска.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Хороший вопрос)) Может notepad? Чтоб редактировал файл hosts, он у всех есть |
||
| process.StartInfo.CreateNoWindow = false;// поменять на true если не хотите видеть окно консоли | ||
| process.Start(); | ||
| process.WaitForExit(); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Нужно выше пояснение какой добавить using или библиотеку в GAC, потому что: