| 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.
Last edited by nigelmercier; 24 Jan 2013 at 09:55 AM..
| My System Specs |
| System Manufacturer/Model Number Homebrew OS Windows 7 Professional x64 CPU Intel Core i5-2500K @ 3.3GHz Motherboard Fatal1ty P67 Professional Memory 8GB Graphics Card Zotac ZONE GeForce GT 240 1GB [ZT-20404-20L] Sound Card On board Monitor(s) Displays 2x Samsung SyncMaster 203B Screen Resolution 1400 x 1050 Keyboard Microsoft Natural Wireless Ergonomic 7000 Mouse Microsoft Natural Wireless Laser 7000 Case CoolerMaster Elite Cooling Zalman |
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 Specs | | System Manufacturer/Model Number Custom Build OS Windows 7 Ultimate x64, BackTrack Linux 5 R2, Windows XP CPU Intel Core i7 920 OC to 3.6GHz Motherboard ASUS P6T Deluxe V2 Memory Corsair 6GB DDR3 Graphics Card ATI Radeon 4890 Monitor(s) Displays ASUS 23" Screen Resolution 1920x1080 PSU Corsair 850w Case CoolerMaster HAF932 Cooling CoolerMaster V8 Hard Drives 150GB Velociraptor
640GB Internet Speed 30Mbps |
25 Jan 2013
|
#3 | | Windows 7 Ultimate x64 Topeka Kansas |
| My System Specs | | OS Windows 7 Ultimate x64 |
26 Jan 2013
|
#4 | | Windows 7 Professional x64 |

Quote: Originally Posted by Parman 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 Specs | | System Manufacturer/Model Number Homebrew OS Windows 7 Professional x64 CPU Intel Core i5-2500K @ 3.3GHz Motherboard Fatal1ty P67 Professional Memory 8GB Graphics Card Zotac ZONE GeForce GT 240 1GB [ZT-20404-20L] Sound Card On board Monitor(s) Displays 2x Samsung SyncMaster 203B Screen Resolution 1400 x 1050 Keyboard Microsoft Natural Wireless Ergonomic 7000 Mouse Microsoft Natural Wireless Laser 7000 Case CoolerMaster Elite Cooling Zalman |
26 Jan 2013
|
#5 | | Windows 7 Ultimate x64 Topeka Kansas |
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 Specs | | OS Windows 7 Ultimate x64 |
26 Jan 2013
|
#6 | | Windows 7 Ult, Windows 8 Pro, San Diego |
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 Specs | | System Manufacturer/Model Number Home built OS Windows 7 Ult, Windows 8 Pro, CPU Q9650-4.275GHz, E8600 4.5GHz, E6750-3.8GHz Motherboard Evga 780i FTW Memory G.Skill PC2 9600 1200Mhz 5 5 5 15 2T Graphics Card GTX480 Sound Card Asus Xonar D2 Monitor(s) Displays HannsG Screen Resolution 1680X1050 Keyboard Logitech G15 Mouse Logitech G9 PSU ThermalTake Toughpower 1000Watt modular Case ThermalTake XaserV Cooling Xigmatek S1283 Hard Drives GSkill Phoenix Pro 120GB SSD Internet Speed T1 |
28 Jan 2013
|
#7 | | Windows 7 Professional x64 |

Quote: Originally Posted by chev65 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 Specs | | System Manufacturer/Model Number Homebrew OS Windows 7 Professional x64 CPU Intel Core i5-2500K @ 3.3GHz Motherboard Fatal1ty P67 Professional Memory 8GB Graphics Card Zotac ZONE GeForce GT 240 1GB [ZT-20404-20L] Sound Card On board Monitor(s) Displays 2x Samsung SyncMaster 203B Screen Resolution 1400 x 1050 Keyboard Microsoft Natural Wireless Ergonomic 7000 Mouse Microsoft Natural Wireless Laser 7000 Case CoolerMaster Elite Cooling Zalman |
28 Jan 2013
|
#8 | | Windows 7 Ultimate x64, BackTrack Linux 5 R2, Windows XP |

Quote: Originally Posted by nigelmercier 
Quote: Originally Posted by Parman 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 Specs | | System Manufacturer/Model Number Custom Build OS Windows 7 Ultimate x64, BackTrack Linux 5 R2, Windows XP CPU Intel Core i7 920 OC to 3.6GHz Motherboard ASUS P6T Deluxe V2 Memory Corsair 6GB DDR3 Graphics Card ATI Radeon 4890 Monitor(s) Displays ASUS 23" Screen Resolution 1920x1080 PSU Corsair 850w Case CoolerMaster HAF932 Cooling CoolerMaster V8 Hard Drives 150GB Velociraptor
640GB Internet Speed 30Mbps |
29 Jan 2013
|
#9 | | Windows 7 Professional x64 |

Quote: Originally Posted by doubled822 
Quote: Originally Posted by nigelmercier 
Quote: Originally Posted by Parman 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 Specs | | System Manufacturer/Model Number Homebrew OS Windows 7 Professional x64 CPU Intel Core i5-2500K @ 3.3GHz Motherboard Fatal1ty P67 Professional Memory 8GB Graphics Card Zotac ZONE GeForce GT 240 1GB [ZT-20404-20L] Sound Card On board Monitor(s) Displays 2x Samsung SyncMaster 203B Screen Resolution 1400 x 1050 Keyboard Microsoft Natural Wireless Ergonomic 7000 Mouse Microsoft Natural Wireless Laser 7000 Case CoolerMaster Elite Cooling Zalman |
29 Jan 2013
|
#10 | | Windows 7 Ult, Windows 8 Pro, San Diego |

Quote: Originally Posted by nigelmercier 
Quote: Originally Posted by chev65 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 Specs | | System Manufacturer/Model Number Home built OS Windows 7 Ult, Windows 8 Pro, CPU Q9650-4.275GHz, E8600 4.5GHz, E6750-3.8GHz Motherboard Evga 780i FTW Memory G.Skill PC2 9600 1200Mhz 5 5 5 15 2T Graphics Card GTX480 Sound Card Asus Xonar D2 Monitor(s) Displays HannsG Screen Resolution 1680X1050 Keyboard Logitech G15 Mouse Logitech G9 PSU ThermalTake Toughpower 1000Watt modular Case ThermalTake XaserV Cooling Xigmatek S1283 Hard Drives GSkill Phoenix Pro 120GB SSD Internet Speed T1 Elevated command via batch file? problems? All times are GMT -5. The time now is 07:33 PM. | |