Hello
someone who can convert this powershell to batch?
thanks!
do{
$p1 = [System.Windows.Forms.Cursor]::Position
Start-Sleep -Seconds 2
$p2 = [System.Windows.Forms.Cursor]::Position
if($p1.X -ne $p2.X -and $p1.Y -ne $p2.Y) {
Stop-Service -Name "wifi driver"
Start-Sleep -Seconds 60
}ELSE {
Start-Service -Name "wifi driver"
}
}until($infinity)
powershell to bat
Moderator: DosItHelp
Re: powershell to bat
Use PowerShell's get-service to get the correspondence between the one-word service name used by the net.exe and sc.exe commands, and the more descriptive name used by PowerShell service management commands.
Then simply use 'net start NAME' or 'net stop NAME' in your batch to start or stop the service.
The other part of your script about Windows forms is impossible to do in pure batch.
You'll need an external program, or a dual-language script, with VBS or JavaScript to manipulate system objects.
Then simply use 'net start NAME' or 'net stop NAME' in your batch to start or stop the service.
The other part of your script about Windows forms is impossible to do in pure batch.
You'll need an external program, or a dual-language script, with VBS or JavaScript to manipulate system objects.