.zip フォルダーの内容を抽出するスクリプトがありますが、うまくいきません (コードは投稿の下部にあります)。宛先フォルダーが存在しない場合は作成し、CopyHere を使用して内容を宛先フォルダーに移動します。スクリプトはフォルダーを作成するところまで実行され、CopyHere 関数の実行中に停止しているように見えます (zip ファイルから何も移動されません)。この時点で Windows ベースのスクリプト ホスト プロセスが無期限に実行されているため、手動で終了する必要があることに注意してください。
このスクリプトは私が所有する仮想マシンだけでなく、他の同僚のマシン (すべて x64 Windows 10 Professional) でも実行されるため、これは私のマシンに特有の問題のようです。
抽出しようとしている場所では完全な権限を持っているので、アクセス許可の問題ではないと思います。マシン間の唯一の違いは、試しに Ubuntu-in-Windows 機能をインストールしたことです。これが問題の原因でしょうか?
プロセスが停止している理由を突き止めるために、他にどのような手順を実行できますか?
ありがとう!
-ショーン
Function unzip(sZip)
Dim oFSO, oShell
dim zip, d
Set oFSO = CreateObject("Scripting.FileSystemObject")
sZipFile = oFSO.GetAbsolutePathName(sZip)
sDestPath = oFSO.GetAbsolutePathName(Left(sZip, Len(sZip) - 4))
If Not oFSO.FolderExists(sDestPath) Then
oFSO.CreateFolder(sDestPath)
End If
Set oShell = CreateObject("Shell.Application")
Set zip = oShell.NameSpace(sZipFile)
set d = oShell.NameSpace(sDestPath)
MsgBox "Got here"
d.CopyHere zip.items, 256
Set oFSO = Nothing
Set oShell = Nothing
End Function
Dim oFSO
Set oFSO = CreateObject("Scripting.FileSystemObject")
sPath = oFSO.GetParentFolderName(WScript.ScriptFullName)
sInstPath = sPath & "\dist\installers\"
aInsts = Array("4-AgilentIOLib.zip", "5-NationalInstrumentsLib.zip")
For i = 0 To UBound(aInsts)
MsgBox "Unzipping " & sInstPath & aInsts(i)
unzip(sInstPath & aInsts(i))
MsgBox "Done"
Next
答え1
CopyHere
このオプション256
はDisplay a progress dialog box but do not show the file names.
ソース
wscript.exe
表示されていないプロンプトが表示される可能性はありますか?またはを使用してスクリプトを実行していますかcscript.exe
? 対話形式で実行していますか?
4
進捗ダイアログを表示しないようにするには、オプション を試してください。また、16+256
を追加することもできます。Respond with "Yes to All" for any dialog box that is displayed.
私もスクリプトを実行しましたが、正常に動作しました。ただし、再度実行すると、既存のファイルを上書きするように求められました。