谢谢! 您的确实可以,我还是不太明白的我那个代码问题点在哪里,我在很多电脑上都是可以运行的,有时候又不行。
下面也是同样的runwait问题,有时候行有时候又不行。
是RunWait 里面的变量有问题吗?
$file2 = @ScriptDir & "\set\VID.txt"
Local $array[19]=["H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
$vid = $array[$i]
$assign = "assign letter=" & $vid
Local $diskno = FileReadLine($file2,3)
_ReplaceStringInFile($file2, $diskno,$assign, 0, 1);选择对应磁盘
Local $szSearchString2 = FileReadLine($file2,1)
Local $szReplaceString2 = "select disk " & $i
_ReplaceStringInFile($file2, $szSearchString2,$szReplaceString2, 0, 1)
Runwait("diskpart /S " & $file2,"",@SW_HIDE);分配磁盘驱动器号
RunWait(@ComSpec & " /c " & 'format ' & $vid &': /fs:ntfs /y /q >>log.txt', "", @SW_HIDE);格式化磁盘 |