home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.msdos.batch      Fun with MS-DOS batch files      42,547 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 40,930 of 42,547   
   foxidrive to Daniel   
   Re: Question about powershellscript to b   
   22 Apr 14 23:05:46   
   
   From: foxidrive@server.invalid   
      
   On 22/04/2014 21:57, Daniel wrote:   
   > Hy Folks ..   
   > I have this powershellscript an need this via batch programming.   
   >   
   >   
   > $devid = "*DEV_4236"   
   > $status = devcon status $devid | Select-String "running"   
   > if($status -eq $null)   
   > {   
   >   write-host "Enabling wireless"   
   >   devcon enable $devid   
   > }   
   > else   
   > {   
   >   write-host "Disabling wireless"   
   >   devcon disable $devid   
   > }   
   >   
   >   
   > Devcon is a substitute for the windows internal device manager.   
   >   
   > With this microsoft programm i can switch devices via commandline.   
   >   
   > I want to switch the wlan device by this script.   
   >   
   > If status said, xxxxxxxxxxxxxxxxxxxxxxxxxxxx something......  "running"   
   >   
   > The command is "devcon disable "*DEV_4236""   
   >   
   > if not running, the command is "devcon enable "*DEV_4236""   
   >   
   > how can i do this by batch ?   
   >   
   > Regards   
   >   
      
   Do you want to toggle the device?  Test this:   
      
      
   @echo off   
   devcon status "*DEV_4236" |find /i "running" >nul && devcon disable   
   "*DEV_4236" & goto :EOF   
   devcon status "*DEV_4236" |find /i "running" >nul || devcon  enable   
   "*DEV_4236" & goto :EOF   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca