Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Process process = new Process();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нужно выше пояснение какой добавить using или библиотеку в GAC, потому что:

Ошибка в действии "CS0246" "Не удалось найти имя типа или пространства имен "Process" (пропущена директива using или ссылка на сборку?)".

process.StartInfo.FileName = "cmd";
Copy link
Member

Choose a reason for hiding this comment

The 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\"";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

не ясно что это за аргументы

process.StartInfo.Verb = "runas"; // запуск с правами администратора
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Было бы хорошо, если тут ещё написать как без прав админа запускать (чтоб могли протестировать с ними или без если у кого-то будут проблемы при запуске чего-то)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нужно бы определиться, для примеров что запускать, у чего есть параметры запуска.

Copy link
Member

@lord-alfred lord-alfred Jan 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Хороший вопрос)) Может notepad? Чтоб редактировал файл hosts, он у всех есть

process.StartInfo.CreateNoWindow = false;// поменять на true если не хотите видеть окно консоли
process.Start();
process.WaitForExit();