0
votes

i'm very new to VBScript, i need to open control panel using VBScript, I tried to open explorer like this

Dim txtFolderToOpen  
txtFolderToOpen = "C:\Windows" 
App.Run txtFolderToOpen 
Set App = Nothing

this works fine, but if i put the path as Control Panel it won't work,

Is there any way to do this? Thank you

2
Do not hard-code paths like C:\Windows in your application. There is no guarantee that the system directory will be on the C: drive, nor that it will be named Windows. - Cody Gray

2 Answers

6
votes

To open the Control Panel, you can Run the %windir%\system32\control.exe file:

CreateObject("WScript.Shell").Run "control.exe"

To open a specific Control Panel applet (.cpl), specify the .cpl file name as a parameter for control.exe:

CreateObject("WScript.Shell").Run "control.exe TimeDate.cpl" ' Open Date/Time properties
-1
votes

To open Programs and Features using a vbscript, use the following command-

CreateObject("WScript.Shell").Run "control.exe Appwiz.cpl"