Elevated command via batch file?

Page 1 of 2 12 LastLast

  1. Posts : 78
    Windows 7 Professional x64
       #1

    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.
      My Computer


  2. Posts : 150
    Windows 7 Ultimate x64, BackTrack Linux 5 R2, Windows XP
       #2

    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 Computer


  3. Posts : 881
    Windows 7 Ultimate x64
       #3

    Use the runas command.
      My Computer


  4. Posts : 78
    Windows 7 Professional x64
    Thread Starter
       #4

    Parman said:
    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 Computer


  5. Posts : 881
    Windows 7 Ultimate x64
       #5

    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 Computer


  6. Posts : 8,870
    Windows 7 Ult, Windows 8.1 Pro,
       #6

    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 Computer


  7. Posts : 78
    Windows 7 Professional x64
    Thread Starter
       #7

    chev65 said:
    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 Computer


  8. Posts : 150
    Windows 7 Ultimate x64, BackTrack Linux 5 R2, Windows XP
       #8

    nigelmercier said:
    Parman said:
    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 Computer


  9. Posts : 78
    Windows 7 Professional x64
    Thread Starter
       #9

    doubled822 said:
    nigelmercier said:
    Parman said:
    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 Computer


  10. Posts : 8,870
    Windows 7 Ult, Windows 8.1 Pro,
       #10

    nigelmercier said:
    chev65 said:
    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 Computer


 
Page 1 of 2 12 LastLast

  Related Discussions
Our Sites
Site Links
About 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 18:01.
Find Us