I have a set of commands like:
C: cd Project testproj.exe
My system receives these commands one by one from the remote system. I need to execute each command in cmd.exe when receiving a command from a remote system. How to execute them using .NET?
I also need to return the result of testproj.exe to the remote computer. How to get the result after running the command?
Process.Startcmd.exe and connect StandardIn, StandardOut and StandardError. Then, when the command arrives, just write it in StandardIn and read StandardOut / Error to return. All this should not exceed 15 LOC.
Process.Start
, Telnet, , - , ....
var process = System.Diagnostics.Process.Start( "testproj.exe" ); process.WaitForExit(); var result = process.ExitCode;
, "C:" "CD-". , .
System.Diagnostics.Process. stdout/stderr -, .
C: cd Project Lanching Directory, SetCurrentDirectory. strong > .
, testproj.exe.
, DOS, , , . Do not allow DELETE, RD, FORMAT ..
, DOS. , , .
, - , / .
UPDATE: the implementation of certain commands is provided to you. You can use the .NET API or have System.Diagnostics.Process
Source: https://habr.com/ru/post/1714450/More articles:MSBuild требует 3 раза памяти Visual Studio для чистой сборки - memoryWCF proxies and userPrincipalName - identityVerifying that all JDBC calls occur in a transaction - javaHow can I control the default font sizes for swing UI without quaqua? - javaIncrease text size in Jtree - swingRuby on Rails field_for Form Helper Problems - ruby-on-railsАктивность PHP/MySQL (ala facebook) - phpHow to use PIL with Tkinter? - pythonASP.NET MVC C #: moving data from multiple tables / queries to a view - c #Is there a built-in attribute for the name / value pair? - .netAll Articles