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

No description
22 Replies
leowest
leowest3w ago
you will have to provide more details about your issue what you expected to happen, what does not happen etc...
Wam-Bam Franko " MiddleMan "
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
leowest
leowest3w ago
you're not reading the output... in your code, you're only redirecting it
Wam-Bam Franko " MiddleMan "
how can i read the output?
leowest
leowest3w ago
you would use the StandardOutput
Wam-Bam Franko " MiddleMan "
im guessing i should remove the string output =
leowest
leowest3w ago
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
Wam-Bam Franko " MiddleMan "
yes its odd because i get an exception for not redirecting the output
leowest
leowest3w ago
what exception
leowest
leowest3w ago
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
Wam-Bam Franko " MiddleMan "
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
leowest
leowest3w ago
then u remove the line where u read it if u turn it off
Wam-Bam Franko " MiddleMan "
ahh so i just need to remove it and itll do it automatically?
leowest
leowest3w ago
that is what I just explained 😉
Wam-Bam Franko " MiddleMan "
fixed mb my brain works weirdly
leowest
leowest3w ago
does it print fine now?
leowest
leowest3w ago
$close
MODiX
MODiX3w ago
If you have no further questions, please use /close to mark the forum thread as answered
Wam-Bam Franko " MiddleMan "
appreciate it dude

Did you find this page helpful?