Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Elevated command via batch file?


24 Jan 2013   #1

Windows 7 Professional x64
 
 
Elevated command via batch file?

I've set up a Virtual Router as in this page, but what it doesn't tell you is that you need to re-run the elevated command netsh wlan start hostednetwork every time the computer boots or comes out of standby.

Is there a way to run an elevated command via a batch file?

Later ... I've just found a similar tutorial here on W7F, and this mentions running batch files as administrator. However, I want to set this up for a novice user to use.


My System SpecsSystem Spec
.

25 Jan 2013   #2

Windows 7 Ultimate x64, BackTrack Linux 5 R2, Windows XP
 
 

I can think of one way---but I recommend disabling standby functionality on this machine. Since it will essentially be your wireless router, you're going to want it running most of the time.

1. Start > Run
2. type gpedit.msc
3. Under Computer Configuration, select Windows Settings.
4. Click on Scripts, and then Startup Scripts.
5. From here you can add your batch file, and it will run under the SYSTEM account when the computer boots up, and should be good to go.

Let us know how it works out!
My System SpecsSystem Spec
25 Jan 2013   #3

Windows 7 Ultimate x64
 
 

Use the runas command.
My System SpecsSystem Spec
.


26 Jan 2013   #4

Windows 7 Professional x64
 
 

Quote   Quote: Originally Posted by Parman View Post
Use the runas command.
I know I can right click the batch file and use Run As Administrator ... but that is too complicated for the user. The Run As Administrator option is greyed out on the batch file properties.

The batch file can't be run until the network is connected, so it needs to be manual.
My System SpecsSystem Spec
26 Jan 2013   #5

Windows 7 Ultimate x64
 
 

I meant one of two thing.

You can put the runas in the batch file to run the command.

Runas (place username and password) (command)

Or you can create two batch files and use the runas command to call (run) the second batch file.

You can also use the task scheduler and run it as admin when the pc boots up or at logon.
My System SpecsSystem Spec
26 Jan 2013   #6

Windows 7 Ult, Windows 8.1 Pro,
 
 

I'm pretty sure that the connectify software for creating a hosted wireless network, can be set to start up automatically when the machine is started. This should be easier for a Novice.

Connectify Hotspot - Connectify
My System SpecsSystem Spec
28 Jan 2013   #7

Windows 7 Professional x64
 
 

Quote   Quote: Originally Posted by chev65 View Post
I'm pretty sure that the connectify software for creating a hosted wireless network, can be set to start up automatically when the machine is started. This should be easier for a Novice.

Connectify Hotspot - Connectify
It's a novice using it, not setting it up, so Connectify is a bit OTT.
My System SpecsSystem Spec
28 Jan 2013   #8

Windows 7 Ultimate x64, BackTrack Linux 5 R2, Windows XP
 
 

Quote   Quote: Originally Posted by nigelmercier View Post
Quote   Quote: Originally Posted by Parman View Post
Use the runas command.
I know I can right click the batch file and use Run As Administrator ... but that is too complicated for the user. The Run As Administrator option is greyed out on the batch file properties.

The batch file can't be run until the network is connected, so it needs to be manual.
Have you looked into my suggestion? You could also set this as a login script as opposed to a startup script, if you're concerned about the network not being active before it runs.
My System SpecsSystem Spec
29 Jan 2013   #9

Windows 7 Professional x64
 
 

Quote   Quote: Originally Posted by doubled822 View Post
Quote   Quote: Originally Posted by nigelmercier View Post
Quote   Quote: Originally Posted by Parman View Post
Use the runas command.
I know I can right click the batch file and use Run As Administrator ... but that is too complicated for the user. The Run As Administrator option is greyed out on the batch file properties.

The batch file can't be run until the network is connected, so it needs to be manual.
Have you looked into my suggestion? You could also set this as a login script as opposed to a startup script, if you're concerned about the network not being active before it runs.
The startup needs to be manual, or when the Wi-Fi has fully connected, it is only valid occasionally.
My System SpecsSystem Spec
29 Jan 2013   #10

Windows 7 Ult, Windows 8.1 Pro,
 
 

Quote   Quote: Originally Posted by nigelmercier View Post
Quote   Quote: Originally Posted by chev65 View Post
I'm pretty sure that the connectify software for creating a hosted wireless network, can be set to start up automatically when the machine is started. This should be easier for a Novice.

Connectify Hotspot - Connectify
It's a novice using it, not setting it up, so Connectify is a bit OTT.
That's as easy as it's going to get. Your Welcome.
My System SpecsSystem Spec
Reply

 Elevated command via batch file?




Thread Tools




Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 08:29 AM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33