Batch file 用于修复Vmware VMDK文件的批处理文件
我一直在尝试编写一个批处理脚本,使我能够一次性修复用于VMWare的损坏的vmdk文件,而不必在每个文件上手动运行该命令。我从来没有对批处理文件做过那么多的工作,现在有点挣扎了!有人能给我指出正确的方向来解释为什么这不起作用吗Batch file 用于修复Vmware VMDK文件的批处理文件,batch-file,vmware,repair,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 direc
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
谢谢你的意见 查看这些更改是否对您有所帮助: 对于每个文件,%%X将替换为文件名。 您可能还需要一个输出文件名,您可以尝试%%~nX fixed%%~xX
为什么不起作用?
cd /d "%VMFolderToFix%"
for %%X in (*.vmdk) do WMWorkstationDir vmware-vdiskmanager -R "%%X"