Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
How To Run CMD Commands In VB6 As Admin.
netsh wlan set hostednetwork mode=allow ssid="admin" key="admin"
HOW CAN I RUN THIS COMMAND WITH ADMIN RIGHTS USING CMD.
Dim sYourCommand As String
sYourCommand = "netsh wlan set hostednetwork mode=allow ssid="admin" key="admin""
Shell "cmd /c " & sYourCommand, vbMaximizedFocus
HOW CAN I RUN ABOVE COMMAND AS ADMIN privileges.
–
–
Declarations:
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Const SW_SHOWNORMAL = 1
Code:
ShellExecute 0, "runas", "c:\folder\yourapp.exe", Parameter, vbNullString, SW_SHOWNORMAL
Source: https://www.vbforums.com/showthread.php?608723-RESOLVED-Run-as-administrator-automatically
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.