用于修复Vmware VMDK文件的批处理文件

时间:2014-09-23 10:42:49

标签: batch-file vmware repair

我一直在尝试编写一个批处理脚本,它允许我一次性修复用于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

感谢您的任何意见!

1 个答案:

答案 0 :(得分:0)

查看这些更改是否为您提供帮助:

"%%X"将替换为每个文件的文件名 您可能还需要输出文件名,您可以尝试"%%~nX-fixed%%~xX"

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