Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I started out trying to use a shortcut to display the Local Area Connection Status window on my desktop by creating a shortcut and assigning it Ctrl+, (comma).

Windows didn't like that, so it added Alt, which ended up being Ctrl+Alt++,.

Since I couldn't figure out a way to eliminate Alt as part of the shortcut keys, I am now trying a different strategy and it's not working. My latest attempt is to use AutoHotkey with the following command:

^,::Run, explorer ::{BA126ADB-2166-11D1-B1D0-00805FC1270E}

Which is what the shortcut target number is, but it won't open the window.

share|improve this question
    
I don't understand your question. Can you post your AutoHotkey script? Windows or AutoHotkey should not be sending [Alt] every time you press [Ctrl], unless you write it that way. –  iglvzx Mar 22 '12 at 23:14
    
Sure, I made a shortcut for the Lan Connection Properties and assigned the following hot keys for it; CTRL + ALT + , –  Carlos Mar 23 '12 at 0:07
    
Didn't realize that hitting return would finish me off. Anyway, my desire is to have CTRL + , be my hot keys but when you select CTRL as part of your hot keys in Windows, it automatically adds ALT so that I end up with CTRL + ALT + , and I want to do away with ALT and just use CTRL + , - does that explain it better? –  Carlos Mar 23 '12 at 0:12
    
where did you get that GUID? It does not open "Local Area Connection" –  iglvzx Mar 24 '12 at 4:58
    
Carlos, I don't want to let you down, so I will devise a detailed, easy to follow solution for you. I can't work on it right now, but I should have time tomorrow after 12:00 Pacific. –  iglvzx Mar 24 '12 at 6:44

3 Answers 3

up vote 4 down vote accepted

I am going to list the manual steps necessary to quickly enable or disable a network adapter. Then, I will translate these steps into AutoHotkey.


By hand:

  1. Open Network Connections from the command line.

    explorer ::{7007ACC7-3202-11D1-AAD2-00805FC1270E}
    

    Network Connections

  2. Once the window is active, press Space to set the focus to the list of adapters.

    list

  3. If the adapter you want to enable/disable is currently selected (i.e. the 1st` on the list), skip to Step #5.

  4. If the adapter is not selected, press Right until it is selected. For example press Right 1 time if the adapter is 2nd on the list, 2 times if it is 3rd, etc.

    2nd

  5. Right-click the adapter and press Down to highlight the Enable or Disable option.

    disable

    enable

  6. Press Enter to Enable or Disable.

  7. Close Network Connections.


Autohotkey:

Using the keyboard shortcut Ctrl+,

^,::

   ;1.
   Run, explorer ::{7007ACC7-3202-11D1-AAD2-00805FC1270E}

   ;2.
   WinWaitActive, Network Connections
   Send, {Space}

   ;3. & 4.
   ;If the adapter is not the 1st, navigate to it.
   ;For example, without the comment (semi-colon):
   ;    Send, {Right 1}
   ;if it is the 2nd adapter.
   ;    Send, {Right 2}
   ;if it is the 3rd, etc.

   ;5.
   Send, {AppsKey}
   Sleep, 250 ;adjust as needed
   Send, {Down}

   ;6.
   Send, {Enter}

   ;7.
   WinClose, Network Connections

   return
share|improve this answer
    
Thank you for responding and I got the message of not posting the same question twice. I'm leaving for a meeting right now but want to clarify something so I'll get back to you a little later. Thanks Carlos –  Carlos Mar 23 '12 at 14:03
    
The shortcut ended up in the "Programs" folder and I don't know how to insert the command. I thought about doing away with the shortcut idea all together and just go directly tothe program I want to run which is the Local Area Connection so I wrote this script but it doesn't work; –  Carlos Mar 23 '12 at 21:57
    
;This is to open my Lan Line Connection - not working ^,:: Run, "Control Panel\Network and Internet\Network Connections\Local Area Connection” Return –  Carlos Mar 23 '12 at 21:58
    
Your code is no good. Paths in the Control Panel are not the same as paths in the filesystem/Windows Explorer. See my updated my answer. :) –  iglvzx Mar 23 '12 at 23:44
2  
The command you gave me opens up the Network Connection as you said but I'm trying to go a step further and open up the LOCAL AREA CONNECTION STATUS window so that I can Enable/Disable the connection. - maybe I didn't make myself clear. I re-wrote the initial question for clarification. Hope that's what you wanted. –  Carlos Mar 24 '12 at 11:08

If you want an easy way to enable or disable your NIC (or other device for that matter), that bypasses the Control Panel, Device Manager, and other windows altogether, you can do so with a a batch file:

  1. Get a copy of Microsoft’s DevCon utility

  2. Create and save the following batch file (e.g., as ToggleNIC.bat)

    @echo off
    if (%1)==(+) goto enable
    if (%1)==(-) goto disable
    goto :eof
    :: Replace the device ID ("VEN_1234&DEV_5678" in the example) with that of your own NIC. :: You can find it with the command "devcon find PCI*", looking for the name of your NIC.
    :: When you locate your device ID, enter only up to the "DEV"; that should be enough to uniquely identify the device. :: Leave the "SUBSYS" and later parts of the string off, otherwise it may not work.
    :enable devcon enable "PCI\VEN_1234&DEV_5678" goto :eof
    :disable devcon disable "PCI\VEN_1234&DEV_5678" goto :eof

  3. Create two shortcuts to the batch file (e.g., EnableNIC.lnk and DisableNIC.lnk), in one specifying the Target field as C:\…\ToggleNIC.bat + and for the other, C:\…\ToggleNIC.bat - (of course replace the with the path to the batch file)

  4. Set a hotkey in the Properties dialog for each shortcut—Ctrl+Alt+Shift+Num+ and Ctrl+Alt+Shift+Num- seem like good, logical ones.

    • (There’s a reason Explorer tries to prevent simple shortcuts of the form Ctrl+Key, Alt+Key, and Shift+Key; because those are normally used in programs for everyday tasks, so using them as shell hotkeys would cause no end of trouble. But, if you really need one without Alt, you can manually hack the .lnk file or easier, just use a macro/hotkey program to create a task to run the batch files with whatever hotkey you like.)

  5. Alternately, you could put the batch file somewhere in your PATH, then you can simply toggle the NIC via the Start menu or Run dialog; e.g. Win+R, togglenic +


You can also make it so that the batch file literally toggles the NIC (enable it if it is currently disabled, or disable it if it is currently enabled), but that will be a little more involved and probably not necessary in general.

share|improve this answer
    
There is a lot here but I will print it out and review it to see if I can do all of that. For now, if you don't mind, please answer me one question; using Autohotkey, how do I show a command that signifies a double click? I have managed to do everything that I need and I could manually double click it if necessary but if there is a way I could end the script with that, it would be the icing on the cake. Thanks –  Carlos Mar 26 '12 at 1:31
    
I can’t tell what you are asking. You have an AHK script that opens the Network Connections window and emulates key press to navigate to the NIC and toggle it? What’s the double-click for/on? What do you mean by “show a command”? –  Synetech Mar 26 '12 at 2:27
    
@Carlos Did my script not work? If the item you want to double-click has focus (i.e. highlighted blue, or with a dotted box), then you can Send {Enter}. Otherwise, you can use the Click command to simulate a mouse click at a specific location. –  iglvzx Mar 26 '12 at 3:56
    
Your script worked fine. I am working on a different script using some of the commands you used on the previous problem and I got it working, All I want to do is end the script with a double click to initiate opening up a window which I am currently doing manually. I'm going to try your suggestion of using the Send, {Enter} and see if that works. If not, i'll try Send {click}. –  Carlos Mar 26 '12 at 5:59
    
Enter worked just find. Thanks again. –  Carlos Mar 26 '12 at 15:02

Just go to the screen where the adapter icon is located. Right click and create shortcut (it won't allow to add shortcut to that window but it will allow it to be created in desktop). When you want to enable or disable the adapter just right click the icon on your desktop and click enable or disable.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.