I know of the Shell method to run files, but how can I execute normal command prompt commands like nslookup, and capture the output as a string?
Thanks for the help! Every google search has just turned up the shell method >_>
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There are many examples here on SO to System.Diagnostics.Process, which is what you’d need.
Since nslookup is and exe in windows – yes. If it was a built in command like say echo, then you’d use the cmd.exe as the program and using the arguments
/c “echo hello program”
Edit: Here is another exmaple
To create a bat file, just open a text editor and add the command you want and save with a .bat extension.