I'm writing my first batch file and have two basic questions. I'm using Windows7 and wondering if there is an easy way to run something as an administrator? At the moment I just type cmd into the search bar and hit ctrl + shift + enter. I can right-click on the file and choose to run it as admin, but I was wondering if I could make this part of my batchfile. The second piece of my question is how to pass arguments to a program that I am opening. At the moment I am using the following code:
ECHO OFF
ECHO This will export a shapefile from my postgresql database
PAUSE
::START "pgsql2shp export" "C:\Program Files (x86)\PostgreSQL\9.1\bin\pgsql2shp.exe" [-f 'D:\test.shp' -h localhost -u postgres -p 5434 spatial_data 'SELECT * FROM public.energy']
::START "pgsql2shp export" "C:\Program Files (x86)\PostgreSQL\9.1\bin\" "-f 'D:\test.shp' -h localhost -u postgres -p 5434 spatial_data 'SELECT * FROM public.energy'" "pgsql2shp.exe"
START "pgsql2shp export" "C:\Program Files (x86)\PostgreSQL\9.1\bin\pgsql2shp.exe" "-f 'D:\test.shp' -h localhost -u postgres -p 5434 spatial_data 'SELECT * FROM public.energy'"
PAUSE
ECHO shpfile complete
PAUSE :: requires user input to end
I have run this file by pasting the following into the command line, after cd-ing to the following dir: C:\Program Files (x86)\PostgreSQL\9.1\bin
>pgsql2shp.exe -f D:\test.shp -h localhost -u postgres -p 5434 spatial_data "SELECT
* FROM public.energy"
My batch file code gives an error on a new terminal, but it disappears before I can read it, and I don't know what is going wrong.

Administratorappears in the title bar and I have to approve the UAC pop-up. – celenius Feb 5 at 17:53