Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Using NCPA.CPL to access Local Area Conn. properties

Using NCPA.CPL to access Local Area Conn. properties

Using NCPA.CPL to access Local Area Conn. properties


I'm trying (and failing) to find a way of scripting access  directly to the 'General' tab of 'Local Area Connections' properties, i.e. without having to go through the 'Control Panel > Network Connections' route then right-clicking on 'Local Area Connection' then choosing the 'Properties' button.

I've tried using the following command:
rundll32.exe shell32.dll,Control_RunDLL ncpa.cpl,,1
(found on VBNet) but this still only gets me to the 'Local Area Connection'.

Does anyone know of a way?


RE: Using NCPA.CPL to access Local Area Conn. properties

I don't know, perhaps. I will have a look. Thank you anyway.

RE: Using NCPA.CPL to access Local Area Conn. properties

What are you actually trying to do when you bring up the Properties screen?  As Linney has hinted, you can probably use VBScript to achieve what you want

BTW, if you run CONTROL NCPA.CPL, it does the same job as your RUNDLL32 statement...

"Insert funny comment in here!"

RE: Using NCPA.CPL to access Local Area Conn. properties

I'm trying to access the TCP/IP properties page. It will be a vbscript that run once when a thin client is getting installed. The person installing the hardware will have to specify either if the thin will use a DHCP to obtain an IP address, or if it will use a static IP, and if it is the  case, enter it.

Because vbscript is so limited with interaction with the user, I thought it would be simpler to use the actual applet then to create a new one to ask and receive input from the user.


Haven't tried anything yet, I had a quick look, looks promising but the problem is, as we are a gouverment office, I'm not suppose, or I don't have the right to use freeware/shareware.

RE: Using NCPA.CPL to access Local Area Conn. properties


I used to use AutoIt but now tend to use AutoHotkey more frequently instead. (See http://www.autohotkey.com/)

Whichever one you use, once you are happy with your script, just compile it into an executable using the compilers that are provided with each program. That way you don't have to install either AutoIt or AutoHotkey itself on the PC's at work.

Here's an example AutoHotkey script. Copy/Paste it into Notepad and save as something like 'nic-properties.ahk'.


; Open Network Connections
Run ncpa.cpl
WinWaitActive, Network Connections,
; Select the first object starting with L and open its Status window
Send, L{ENTER},
WinWaitActive, Local Area,
; Press the Properties button to open its window
Send, {SPACE},
sleep, 200
WinWait, Local Area,
IfWinNotActive, Local Area, , WinActivate, Local Area,
WinWaitActive, Local Area,

When you run this using AutoHotkey it will open the Properties of the Local Area Network Connection for you.

Hope this helps...

RE: Using NCPA.CPL to access Local Area Conn. properties

And this is the VBScript equivalent.  Just paste the code into a text file, save it with a VBS extension (eg NETWORK.VBS) then double-click on it to run it.  If you were to automate the running of this code, you would need to use WSCRIPT (eg WSCRIPT NETWORK.VBS)


set WshShell = CreateObject("WScript.Shell")

'Launch NCPA and wait for 2 seconds
WshShell.Run "control ncpa.cpl"
WScript.Sleep 2000

'Wait until the application has loaded - Check every second
While WshShell.AppActivate("Network Connections") = FALSE
wscript.sleep 1000

'Bring the application to the foreground
WshShell.AppActivate "Network Connections"
WScript.Sleep 500

'Send keys to select the first connection starting with L
WshShell.SendKeys "L"
WScript.Sleep 501

'Send keys to Bring up the File Menu
WshShell.SendKeys "%f"
WScript.Sleep 501

'Send keys to Choose Properties (shortcut key is R)
WshShell.SendKeys "r"
WScript.Sleep 501

"Insert funny comment in here!"

RE: Using NCPA.CPL to access Local Area Conn. properties

I have posted many questions over time in different forum in here, but never received as many helpful hint as this one generate, it's great.  Thank you to every one. I think I've got all the tools I need to continue my project.

Thanks again.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close