|
Answer» Hello guys. I am NEW on this forum and new also new in learn about batch file. Me question is about a code made it in c programming. If i run this code allows me to shutdown the computer,but also i want to run this code in a batch file to shutdown the computer. The path of this code is : C:\Users\mircea\Desktop\Shutdown My Computer\bin\Debug\Shutdown My Computer.exe. I have tried many options but no result.
Look at this code in C :
Code: [Select]#include <stdio.h> #include <stdlib.h>
int main() { char ch; printf("\n Do you want to shutdown the computer (y/n) ?\n\n"); printf(" "); scanf("%c", &ch); if(ch == 'y' || ch == 'Y') system("C:\\WINDOWS\\System32\\shutdown -s"); return 0; }
I wait some advices. Thank you. All the best.No clue why you are using a C program when you can do it all in batch. But to run your executable from a batch file just PUT this in a batch file.
Code: [Select]"C:\Users\mircea\Desktop\Shutdown My Computer\bin\Debug\Shutdown My Computer.exe"I ALWAYS wonder why there are so many people who write batch code in C.why not just shutdown /r /f
|