0

I would like to create a batch file in order to run a windows command on command prompt as administrator whenever I start the PC.

For example I would like to run the command prompt as administrator and run the command Ping 8.8.8.8 on startup of windows.

Can anyone please explain the full procedures with snapshots?

Thanks in advance M. Ashraful Haque

Héctor William
  • 756
  • 6
  • 24
  • possible duplicate of [Batch Script to Run as Administrator](http://stackoverflow.com/questions/14639743/batch-script-to-run-as-administrator) – Donovan Muller Jul 23 '14 at 09:32

2 Answers2

0

You could try something like this create another batch file and add the below command it will run it as the user you specify

@echo off
Runas /env /user:PCNAME\Administrator test.bat

Or

you can add your batch file to the Scheduled task list link below on how to do this. In Scheduled Task you can set what account to use and when it should run.

Change when it runs in create task go to Triggers tab click new and change "Begin the task" to start up

Create Scheduled Task

Badradish
  • 196
  • 1
  • 13
0

First with SCHTASKS you can create add a batch file to run as a service and you can give the top privileges , example:

SCHTASKS /Create /TN "Ping My Web Host" /SC HOURLY /TR "C:\services\pinghost.cmd" /RU username /RP password /RL HIGHEST

Here's the documentation documentation and here

And this you'd wanted to read this.

Community
  • 1
  • 1
Héctor William
  • 756
  • 6
  • 24