- 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(“Location of the file”);
Enter the location of the file inside the brackets. While entering the location don’t forget to replace “/” with “//”.
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 insideshell_exec()
.
For eg:
Shell_exec(“mspaint”);
This code will open paint application