- Create a new php file using any IDE of your choice ( Netbeans,Dreamweaver etc)
- Write the following code inside the file.
- Save in htdocs folder under XAMP.
- Run the file by entering “Localhost” in the browser.
Shell_exec(“shutdown /s”);
The working is simple. shell_exec()
function will act as Run
in start menu in windows. If we enter the location of a file in Run, it will open the file.
We use several commands in run to open applications like mspaint, notepad, gpedit.msc etc. All these commands can also be given inside shell_exec()
.