2014-09-23 44 views
0

我一直在試圖編寫一個批處理腳本,它允許我一次性修復用於VMWare的破損的vmdk文件,而不必在每個文件上手動運行該命令。從來沒有真正用批處理文件工作過多,我有點煩惱!任何人都可以指出我正確的方向,爲什麼這不起作用?修復Vmware VMDK文件的批處理文件

set /p WMWorkstationDir = Enter the directory of the VmWare Workstation install, and press enter; 
set /p VMFolderToFix = Enter the directory where the VMDK files live that you wish to repair, and press enter; 
Rem this is to set up working names in the batch file for the directories specified, helping abstract it 
cd VMFolderToFix 
for %%X in (*.vmdk) do WMWorkstationDir vmware-vdiskmanager -R 
Rem trying to get the repair command to run on all the vmdk files in the target location 

感謝您的任何意見!

+0

爲什麼不工作? – kkuilla 2014-09-23 10:47:15

回答

0

看看這些變化給你的幫助:

"%%X"將通過文件名來代替,每個文件。
您可能需要一個輸出文件名也,你可以嘗試"%%~nX-fixed%%~xX"

cd /d "%VMFolderToFix%" 
for %%X in (*.vmdk) do WMWorkstationDir vmware-vdiskmanager -R "%%X"