How to create & write into Batch file using c#?
Hi...
I want to create a new batch file on the pc & then i want to write some data in that batch file...
suppose i want to make 1 batch file to restart the PC.
so i need to create a new Batch file in the system and then i have to write in the batch file.
and after writing i want to run it...so can u tell me how can i implement this???
i know the code how to restart pc...
i have tried to write in the batch file using below code but not able to write in the batch file..so plz check the code and give me correct code.
FileStream fs=new FileStream(Application.StartupPath+"//test.BAT",FileMode.Create);
StreamWriter w=new StreamWriter(fs);
w.WriteLine("shutdown.exe -r");