If you are working on computers, then often you have to perform many tasks on Windows and to execute these tasks, you usually run a lot of commands. The running of these commands makes your work easy by delivering higher output; however, running these commands one by one is not easy, and so, here comes the role of batch files. Batch files are the most important feature introduced by Microsoft, which runs several commands in just one go on the various operating systems. A batch file could be defined as the collection or list of commands that are processed in sequence and is used for loading programs along with running multiple processes at one go without user intervention. Batch files execute several tasks for the user at one time and always run in the background, increasing productivity. So, if you don’t want to run commands manually or one by one then, you must know the procedure to run batch files as an Administrator in one go, and this could be done by only right-clicking on the batch file selected to run and then click on Run as Administrator. But before going to the steps to run the batch file as Administrator, you need to know the procedure to create a secure batch file on Window 10 which is very simple to do by following the below-given steps:-
- First of tap on the “Start” button and then keep searching for Notepad.
- After then, you have to click on the results appearing on the top for launching the app.
- Now, after typing below given simple lines, you will be able to create a simple batch file. The lines are @ECHO OFF
- ECHO CONGRATULATIONS! YOUR FIRST BATCH FILE EXECUTED SUCCESSFULLY.PAUSE
- After getting the message of congratulations, you have to go to the “File” menu and then choose the option “Save as.”
- Finally, write a name for the file and then click double on .bat file to run it.
You can also create a compound batch file which could run multiple commands by following the steps mentioned above but with little modifications which are the following:-
- You have to click on the “Start” button and then tap on the results visible on the top to launch the app after taping on Notepad.
- Again, you have to write some lines to create a complex batch file, and the text to type could be
:: This batch file reveals OS, hardware, and networking configuration.
TITLE My System Info
ECHO Please wait… Checking system information.
:: Section 1: OS information.
ECHO OS INFO
systeminfo | findstr /c:”OS Name”
systeminfo | findstr /c:”OS Version”
systeminfo | findstr /c:”System Type”
:: Section 2: Hardware information.
ECHO HARDWARE INFO
systeminfo | findstr /c:”Total Physical Memory”
wmic cpu get name
:: Section 3: Networking information.
ECHO NETWORK INFO
ipconfig | findstr IPv4
ipconfig | findstr IPv6
- In further steps, again tap on the menu “File” and then click on “Save as” option
- At the end, write the name of your script and double click on the extension.bat file.
Now, here are the steps you should follow to run batch files as Administrator without prompt in Windows10:-
- First of all, search the Batch file and then click right on it.
- Further, it would help if you created shortcuts, and for that, tap on the option “Create Shortcut.”
- In the next step, you have to give a proper name and so type the name you want to give and then tap on it.
- After then, you have to click right on the shortcut file and then tap on option “Properties.”
- In further steps, you have to choose the Shortcuts tab and then click on it.
- Again, you will be prompted to the option “Advanced” where you have to click.
- After clicking on Advanced, you have to choose and click on “Runs As Administrator box.”
- In the end, you have completed the procedure by clicking on Ok or Apply button and then finally exit.
- When the procedure is completed, the Batch file will always run as Administrator whenever you click on the short cut.