![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | How deactivate-reactivate a hardware component and start a service by script / command-line ? Hi, have my USB Wireless dongle constatntly dropping ( although drivers ok and up-to-date, constantly awake etc) Have to deactivate it, re-activate it and start a services which it relies on to most often regain connetcion to the web. Doing theses maneuvers is tedious so I am looking for a simpler way to achieve it with one click on a batch or script Possible ? The dongle I use is an ASUS Wireless USB Network Adapter ( with Ralink drivers) TIA |
My System Specs![]() |
| | #2 (permalink) |
| | Re: How deactivate-reactivate a hardware component and start a service by script / command-line ? "MoiMeme" <antispam@xxxxxx> wrote in message news:%23fuetfHfJHA.5408@xxxxxx Quote: > Hi, > > have my USB Wireless dongle constatntly dropping ( although drivers ok and > up-to-date, constantly awake etc) > > Have to deactivate it, re-activate it and start a services which it relies > on to most often regain connetcion to the web. > > Doing theses maneuvers is tedious so I am looking for a simpler way to > achieve it with one click on a batch or script > > Possible ? > > The dongle I use is an ASUS Wireless USB Network Adapter ( with Ralink > drivers) > > TIA sufficient. With my own USB dongle the commands would be: @echo off net stop ANIWZCSdService net start ANIWZCSdService |
My System Specs![]() |
| | #3 (permalink) |
| | Re: How deactivate-reactivate a hardware component and start a service by script / command-line ? Ok for the service. That works. But most often I have to deactivate the dongle in hardware manager, the reactivate it . Can that be done as well ? ( Soory for direct reply ! was not intended so !) "Pegasus (MVP)" <I.can@xxxxxx> a écrit dans le message de news: %23eUT7kHfJHA.2384@xxxxxx Quote: > > "MoiMeme" <antispam@xxxxxx> wrote in message > news:%23fuetfHfJHA.5408@xxxxxx Quote: >> Hi, >> >> have my USB Wireless dongle constatntly dropping ( although drivers ok >> and up-to-date, constantly awake etc) >> >> Have to deactivate it, re-activate it and start a services which it >> relies on to most often regain connetcion to the web. >> >> Doing theses maneuvers is tedious so I am looking for a simpler way to >> achieve it with one click on a batch or script >> >> Possible ? >> >> The dongle I use is an ASUS Wireless USB Network Adapter ( with Ralink >> drivers) >> >> TIA > Hard to say. Perhaps stopping, then restarting the service would be > sufficient. With my own USB dongle the commands would be: > @echo off > net stop ANIWZCSdService > net start ANIWZCSdService > > |
My System Specs![]() |
| | #4 (permalink) |
| | Re: How deactivate-reactivate a hardware component and start a service by script / command-line ? Here is a batch file that can enable/disable a device. You invoke it with a parameter of "enable" or "disable". @echo off if /i "%1"=="enable" goto start if /i "%1"=="disable" goto start goto :eof :Start setlocal enabledelayedexpansion set Desc=Name: USB Mass Storage Device set HWID=x set count=0 set found=no devcon hwids "usb\vid*" > c:\usb.txt for /F "tokens=*" %%* in (c:\usb.txt) do ( set /a count=!count! + 1 if /i "%%*"=="%Desc%" set found=yes& set count=1 if !found!==yes if !count!==4 set HWID=%%* ) echo HWID=!HWID! devcon %1 "!HWID!" endlocal del c:\usb.txt By setting Desc=Name: USB Mass Storage Device in the batch file, it will enable/disable a USB-connected disk. Your challenge is to find the appropriate description for your wireless dongle. You can do it like so: - Execute these commands from a Command Prompt: devcon hwids "usb\vid*" > c:\usb.txt notepad c:\usb.txt - Look for an identifier for your dongle. You can download devcon.exe from here: http://download.microsoft.com/downlo...240/devcon.exe "MoiMeme" <antispam@xxxxxx> wrote in message news:%23NoQsHIfJHA.5408@xxxxxx Quote: > Ok for the service. That works. > > But most often I have to deactivate the dongle in hardware manager, the > reactivate it . > > Can that be done as well ? > > ( Soory for direct reply ! was not intended so !) > > "Pegasus (MVP)" <I.can@xxxxxx> a écrit dans le message de news: > %23eUT7kHfJHA.2384@xxxxxx Quote: >> >> "MoiMeme" <antispam@xxxxxx> wrote in message >> news:%23fuetfHfJHA.5408@xxxxxx Quote: >>> Hi, >>> >>> have my USB Wireless dongle constatntly dropping ( although drivers ok >>> and up-to-date, constantly awake etc) >>> >>> Have to deactivate it, re-activate it and start a services which it >>> relies on to most often regain connetcion to the web. >>> >>> Doing theses maneuvers is tedious so I am looking for a simpler way to >>> achieve it with one click on a batch or script >>> >>> Possible ? >>> >>> The dongle I use is an ASUS Wireless USB Network Adapter ( with Ralink >>> drivers) >>> >>> TIA >> Hard to say. Perhaps stopping, then restarting the service would be >> sufficient. With my own USB dongle the commands would be: >> @echo off >> net stop ANIWZCSdService >> net start ANIWZCSdService >> >> > |
My System Specs![]() |
| | #5 (permalink) |
| | Re: How deactivate-reactivate a hardware component and start a service by script / command-line ? Thanks. That works fine ! Many thanks again. "Pegasus (MVP)" <I.can@xxxxxx> a écrit dans le message de news: e$VHaqIfJHA.500@xxxxxx Quote: > Here is a batch file that can enable/disable a device. You invoke it with > a parameter of "enable" or "disable". > @echo off > if /i "%1"=="enable" goto start > if /i "%1"=="disable" goto start > goto :eof > > :Start > setlocal enabledelayedexpansion > set Desc=Name: USB Mass Storage Device > set HWID=x > set count=0 > set found=no > > devcon hwids "usb\vid*" > c:\usb.txt > for /F "tokens=*" %%* in (c:\usb.txt) do ( > set /a count=!count! + 1 > if /i "%%*"=="%Desc%" set found=yes& set count=1 > if !found!==yes if !count!==4 set HWID=%%* > ) > echo HWID=!HWID! > devcon %1 "!HWID!" > endlocal > del c:\usb.txt > > By setting Desc=Name: USB Mass Storage Device in the batch file, it will > enable/disable a USB-connected disk. Your challenge is to find the > appropriate description for your wireless dongle. You can do it like so: > - Execute these commands from a Command Prompt: > devcon hwids "usb\vid*" > c:\usb.txt > notepad c:\usb.txt > - Look for an identifier for your dongle. > > You can download devcon.exe from here: > http://download.microsoft.com/downlo...240/devcon.exe > > > "MoiMeme" <antispam@xxxxxx> wrote in message > news:%23NoQsHIfJHA.5408@xxxxxx Quote: >> Ok for the service. That works. >> >> But most often I have to deactivate the dongle in hardware manager, the >> reactivate it . >> >> Can that be done as well ? >> >> ( Soory for direct reply ! was not intended so !) >> >> "Pegasus (MVP)" <I.can@xxxxxx> a écrit dans le message de news: >> %23eUT7kHfJHA.2384@xxxxxx Quote: >>> >>> "MoiMeme" <antispam@xxxxxx> wrote in message >>> news:%23fuetfHfJHA.5408@xxxxxx >>>> Hi, >>>> >>>> have my USB Wireless dongle constatntly dropping ( although drivers ok >>>> and up-to-date, constantly awake etc) >>>> >>>> Have to deactivate it, re-activate it and start a services which it >>>> relies on to most often regain connetcion to the web. >>>> >>>> Doing theses maneuvers is tedious so I am looking for a simpler way to >>>> achieve it with one click on a batch or script >>>> >>>> Possible ? >>>> >>>> The dongle I use is an ASUS Wireless USB Network Adapter ( with Ralink >>>> drivers) >>>> >>>> TIA >>> >>> Hard to say. Perhaps stopping, then restarting the service would be >>> sufficient. With my own USB dongle the commands would be: >>> @echo off >>> net stop ANIWZCSdService >>> net start ANIWZCSdService >>> >>> >> > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| noob: PS script fails, but runs from command line | PowerShell | |||
| Running a command from inside a script, command line is corrupted | PowerShell | |||
| Running a Command line script from within powershell. | PowerShell | |||
| Script from command-line | PowerShell | |||
| NET START STOP Service Command Line | Vista General | |||