خرید بک لینک

Vote count: 0

I want to compress some folders with the batch/vbs solution like here: http://superuser.com/a/112094

This one works, but the original solution uses the "sleep"- function and my archives have different filesizes, so that this wouldn´t work properly. My idea was to use the Run command (wait parameter), but it fails.

set FILETOZIP=C:usersxyzdocumentsfolderOrfile
set TEMPDIR=C:usersxyzdocumentstemp
rmdir %TEMPDIR% /s /q
mkdir %TEMPDIR%
xcopy /s %FILETOZIP% %TEMPDIR%

echo Set objArgs = WScript.Arguments > _zipIt.vbs
echo InputFolder = objArgs(0) >> _zipIt.vbs
echo ZipFile = objArgs(1) >> _zipIt.vbs
echo CreateObject("Scripting.FileSystemObject").CreateTextFile(ZipFile, True).Write "PK" ^& Chr(5) ^& Chr(6) ^& String(18, vbNullChar) >> _zipIt.vbs
echo Set objShell = CreateObject("Shell.Application") >> _zipIt.vbs
echo Set source = objShell.NameSpace(InputFolder).Items >> _zipIt.vbs

echo theString = objShell.NameSpace(ZipFile).CopyHere(source) >> _zipIt.vbs
echo objShell.Run theString, 1, true >> _zipIt.vbs

CScript  _zipIt.vbs  %TEMPDIR%  C:usersxyzdocumentssomeArchive.zip 

pause

The error message is the following:

Object doesn't support this property or method: objShell.Run

How can I achieve that the scripts wait till the zip is created?

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 5 فروردين 1395 ساعت: 23:31

صفحه بندی