下面的代码运行时出现错误
我已经尝试过从其他随后运行的脚本运行vbs脚本,并让批处理脚本在运行vbs脚本之前执行其他任务。
如果在.bat完成后我自己运行.vbs脚本,那么它将无错误运行
@echo off
echo ZipFile="zipfile.zip">unzip.vbs
echo ExtractTo=".\">>unzip.vbs
echo Set fso = CreateObject("Scripting.FileSystemObject")>>unzip.vbs
echo sourceFile = fso.GetAbsolutePathName(ZipFile)>>unzip.vbs
echo destFolder = fso.GetAbsolutePathName(ExtractTo)>>unzip.vbs
echo Set objShell = CreateObject("Shell.Application")>>unzip.vbs
echo Set FiZ=objShell.NameSpace(sourceFile).Items()>>unzip.vbs
echo objShell.NameSpace(destFolder).copyHere FiZ, 16>>unzip.vbs
echo Set fso = Nothing>>unzip.vbs
echo Set objShell = Nothing>>unzip.vbs
echo Set FiZ = Nothing>>unzip.vbs
echo Set objFSO = CreateObject("Scripting.FileSystemObject")>>unzip.vbs
echo strScript = Wscript.ScriptFullName>>unzip.vbs
echo objFSO.DeleteFile("zipfile.zip")>>unzip.vbs
echo objFSO.DeleteFile(strScript)>>unzip.vbs
WScript unzip.vbs
del "%~f0"
启动vbs脚本后立即运行批处理脚本时出现错误
第3行
字符:1
错误:在自动化过程中找不到文件名或类名
操作:“ CreateObject”
我需要批处理脚本
创建.vbs脚本
运行它以解压缩zip文件
删除自身