所以我想創建一個批處理文件,將根據另一個程序的輸出做不同的事情。基本上,第一個程序輸出一些關於硬盤驅動器加密狀態的信息。下面是當一個驅動器未加密在Windows批處理文件FOR/F循環故障
S:\>beinvvol.exe xlc
------------------------------------------------------------------------
BEInvVol, Utimaco Safeware AG - A member of the Sophos Group
Decommissioning Tool for fully SGN-encrypted Volumes
------------------------------------------------------------------------
&Info: SGN filter driver off
&Info: Target log-file "S:\BEInvVol.log"
------------------------------------------------------------------------
Listing info for the target volume(s) -command xlc
Date: 2011-07-26 13:31:01
[Volume C:]
Drive Type: DRIVE_FIXED
[Boot Sector]
Media Type: Plain -not SGN
Media Label:
Media Serial Number: {8C19-DCCD}
File System: NTFS
Size: 232.88 GB
這裏輸出時的驅動器加密
S:\>beinvvol.exe xle
------------------------------------------------------------------------
BEInvVol, Utimaco Safeware AG - A member of the Sophos Group
Decommissioning Tool for fully SGN-encrypted Volumes
------------------------------------------------------------------------
&Info: SGN filter driver off
&Info: Target log-file "S:\KeyDestroy\BEInvVol.log"
------------------------------------------------------------------------
Listing info for the target volume(s) -command xle
Date: 2011-07-26 12:41:48
[Volume E:]
Drive Type: DRIVE_FIXED
[Boot Sector]
Media Type: SGN -fully encrypted
SGN Media GUID: {83490018-50C3-B4E3-829E-ACE3B23C86D3}
File System: NTFS
Size: 298.09 GB
[KSA Original]
Sector Offset ..... 0x0000000000065ED8 (417496)
Byte Offset ....... 0x000000000CBDB000 (213757952)
Size in Sectors ... 0x15 (21)
Size in Bytes ..... 0x2A00 (10752)
[KSA Backup]
Sector Offset ..... 0x000000002542D660 (625137248)
Byte Offset ....... 0x0000004A85ACC000 (320070270976)
Size in Sectors ... 0x15 (21)
Size in Bytes ..... 0x2A00 (10752)
的「XLC」和「XLE」的論點是什麼,你得到的選擇驅動器。所以,我看到在未加密驅動器中,對於「介質類型」,我有「Plain -not SGN」,對於加密驅動程序,我有「SGN -fully encrypted」
現在,我試圖編寫一個FOR/F循環,當它看到「Plain -not SGN」時,它會轉到文件的另一部分。這裏是我的批處理腳本至今:
@ECHO OFF
::Determine if drive is encrypted
FOR /F "tokens=3,4,5 delims= " %%A IN ('S:\beinvvol.exe xlc') DO IF /I "%%A%%B%%C"=="Plain-notSGN" GOTO NOTENCRYPTED
:ENCRYPTED
ECHO Yes
GOTO END
:NOTENCRYPTED
ECHO No
:END
現在,我的思維過程是,從第三個,第四和第五代幣列表中(對於我感興趣的行,第一個令牌將被「媒體「,第二個是」類型「,第三,第四和第五個將是」普通「,」不「和」SGN「或」SGN「」完全「」加密「),字符串將等於「Plain-notSGN」(只是連接所有這些字符串)。但是,這不起作用。有什麼建議麼?
這是聰明的。從未見過&&和||之前一起使用。我想我會更改一些批處理腳本= D – Mechaflash
謝謝,我喜歡這個版本!也感謝您的解釋;我剛開始使用批處理文件,以及不明確的運算符(如> >> &&& |) ||很容易混淆。 – romellem