如何以管理员身份在 VB6 中运行 CMD 命令。
netsh wlan set hostednetwork mode=allow ssid="admin" key="admin"
如何使用 CMD 以管理员权限运行此命令。
Dim sYourCommand As String
sYourCommand = "netsh wlan set hostednetwork mode=allow ssid="admin" key="admin""
Shell "cmd /c " & sYourCommand, vbMaximizedFocus
我如何以管理员权限运行以上命令。
声明:
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
代码:
ShellExecute 0, "runas", "c:\folder\yourapp.exe", Parameter, vbNullString, SW_SHOWNORMAL
来源:https://www.vbforums.com/showthread.php?608723-RESOLVED-Run-as-administrator-automatically
Shell“C:\Windows\System3