✅ using forms to access cmd and execute commands but no functionality.

22 Replies
you will have to provide more details about your issue what you expected to happen, what does not happen etc...
im basically trying to automate usual cmd commands via buttons
so creating a process of cmd on the specified button this case for sfc /scannow
its detecting the command now but there is no console output for the command running
you're not reading the output... in your code, you're only redirecting it
how can i read the output?
you would use the StandardOutput

im guessing i should remove the string output =
https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.process.standardoutput?view=net-9.0
that is storing the output of the command
you need to print it somewhere
or stop redirecting the output
so it prints to the console window
yes
its odd because i get an exception for not redirecting the output
what exception

it works like this
if u redirect the output
then u use standardoutput to read it
if u dont redirect it then u dont use that
if u use it without redirecting then u get an exception
the redirection of the output it so you can read it from your code
as opposed to printing it to the open console window
yeah so when redirectstandardoutput is true it doesnt print to the cmd window
i have to false it
but then i get the exception
but it has the affect i want to print to cmd
then u remove the line where u read it
if u turn it off
ahh so i just need to remove it and itll do it automatically?
that is what I just explained 😉
fixed
mb
my brain works weirdly
does it print fine now?
indeed
$close
If you have no further questions, please use /close to mark the forum thread as answered
appreciate it dude