我正在製作一個批次腳本,它安裝 ISO 檔案並從安裝位置安裝應用程式(VS 2012),如下所示:
K:\Softwares\VS12.iso
%DRIVE_LETTER%:\vs_ultimate.exe /passive /norestart
但問題是取得ISO掛載的盤符。有人知道如何取得磁碟機號嗎?
答案1
嘗試這個:
for /f "tokens=3 delims=\:" %%d in ('reg query hklm\system\mounteddevices ^| findstr /c:"5C003F00" ^| findstr /v "{.*}"') do (
if exist %%d:\vs_ultimate.exe %%d:\vs_ultimate.exe /passive /norestart
)