You are not logged in.

#1 05 Jul 2015 18:13

martinchuanhkhoa
New Member
Registered: 05 Jul 2015
Posts: 2

netsh wlan show drivers | find two strings

I want to add these two commands:
netsh wlan show drivers | find "administrator" && msg * "Please run as Administrator" && exit
netsh wlan show drivers | find "Hosted network supported  : Yes" || msg * "Your Wireless Network Adapter is not supported."
to make one single command with one "netsh wlan show drivers" but still functions like the two above, if the 1st command is processed, the 2nd will not be done
Please help me

Offline

#2 07 Jul 2015 01:43

RG
Member
From: Minnesota
Registered: 18 Feb 2010
Posts: 362

Re: netsh wlan show drivers | find two strings

This will do what you want. We don't care about the output from OPENFILES. Just use it to detect if we have Admin privileges.

openfiles >nul && (netsh wlan show drivers | find "Hosted network supported  : Yes" || echo * Your Wireless Network Adapter is not supported.) & pause

Windows Shell Scripting and InstallShield

Offline

#3 07 Jul 2015 06:27

martinchuanhkhoa
New Member
Registered: 05 Jul 2015
Posts: 2

Re: netsh wlan show drivers | find two strings

thank you, it's helpful, but I've found another solution which is more particular
for /f %%D in ('netsh wlan show drivers ^| findstr /i /c:"Hosted network supported  : No"  /c:"administrator"') do (
set x=%%D
if %%D==Hosted msg * /time:4 Your Wireless Network Adapter is not supported. && exit
)
set x | find "x=" && msg * /time:3 "Please right click the file -> Run as Administrator to start."

Offline

Board footer

Powered by