【.cmd】 バッチファイルスクリプト %15 【.bat】 (794レス)
【.cmd】 バッチファイルスクリプト %15 【.bat】 http://mevius.5ch.net/test/read.cgi/tech/1663153441/
上
下
前次
1-
新
通常表示
512バイト分割
レス栞
抽出解除
必死チェッカー(本家)
(べ)
自ID
レス栞
あぼーん
409: デフォルトの名無しさん [sage] 2023/07/24(月) 23:51:25.15 ID:wZUfbAlM WMI(CIM)が楽かな。 powershellでもVBScriptでもwmicでもお好きなもので。 PowerShell版: $enabledCd = 0 $disabledCd = 22 $methodName = $null $device = Get-CimInstance -Query 'select * from Win32_PnpEntity where Name = "Fax"' if ($device.Status -eq 'OK' -and $device.ConfigManagerErrorCode -eq $enabledCd) { $methodName = 'Disable' } elseif ($device.Status -eq 'Error' -and $device.ConfigManagerErrorCode -eq $disabledCd) { $methodName = 'Enable' } if (! [string]::IsNullOrEmpty($methodName)) { $result = Invoke-CimMethod -InputObject $device -MethodName $methodName $result } ワンライナー版: powershell -c "$d=gcim -cl Win32_PnpEntity -f 'Name=''Fax'''; $s,$c=$d.Status,$d.ConfigManagerErrorCode; if($n=if($s -eq 'OK' -and $c -eq 0){'Disable'}elseif($s -eq 'Error' -and $c -eq 22){'Enable'}){$d|icim -m $n}" http://mevius.5ch.net/test/read.cgi/tech/1663153441/409
410: デフォルトの名無しさん [sage] 2023/07/24(月) 23:59:01.49 ID:wZUfbAlM 「楽」って書いたけど別に楽ではないな。 devcon入ってない場合に入れなくて済むくらいか。 http://mevius.5ch.net/test/read.cgi/tech/1663153441/410
メモ帳
(0/65535文字)
上
下
前次
1-
新
書
関
写
板
覧
索
設
栞
歴
スレ情報
赤レス抽出
画像レス抽出
歴の未読スレ
AAサムネイル
Google検索
Wikipedia
ぬこの手
ぬこTOP
0.030s