2

I successfully created a batch file to flush my DNS.

I have added a pause, I noticed in the title bar of the console window… It's not running as administrator.

I've already tried a couple of variations of this… Just a little guidance would be most appreciated.

I remember reading a blog somewhere, it said something about capitalization wasn't important… Is camel casing important in writing batch files?

@echo off
echo.
pause
CD..
CD..
echo.
runas /user:<Administrator> ipconfig /flushdns
echo.
pause
echo.
Dave
  • 25,297
  • 10
  • 57
  • 69
WidmarkRob
  • 21
  • 2
  • This has been answered already at: http://superuser.com/questions/788924/is-it-possible-to-automatically-run-a-batch-file-as-administrator – Antp Oct 27 '14 at 02:38

2 Answers2

1

The user name must be in one of the following two forms:

If you want to use the Administrator account on your computer, for the /user: parameter, type one of the following:

/user: AdministratorAccountName @ ComputerName
/user: ComputerName \ AdministratorAccountName

The spaces around the "@" and the "\" should not be present - I suspect that they are there to make it easier to read.

Source

ChrisF
  • 41,278
  • 17
  • 101
  • 154
  • @RandolphWest - I wondered about that, but that's how it's written in the Technnet documentation. – ChrisF Oct 16 '12 at 16:25
0

Either Press and hold Ctrl+Shift while opening the program or Right click on the program and click on Run as administrator.

Sathyajith Bhat
  • 61,504
  • 38
  • 179
  • 264
Dave
  • 25,297
  • 10
  • 57
  • 69