Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '>nul 2>&1|| copy /Y %windir%\System32\doskey.exe %windir%\System32\'.exe >nul
- '&&@echo off && cls &&goto :end_vbs
- '& rem-- Save this as .bat
- '& rem-- it's a hybrid bat/vbs script
- '& rem-- deletes a content inside a folder in an archive
- '& rem-- by Vasil "npocmaka" Arnaudov
- ZipFile = WScript.Arguments.Item(0)
- FolderName = WScript.Arguments.Item(1)
- TempDir = WScript.Arguments.Item(2)
- private const FOF_NOCONFIRMATION = 16
- Dim objShell, objSource ,objFolder ,objSourceParent ,objParentFolder
- ' Create the required Shell objects
- Set objShell = CreateObject( "Shell.Application" )
- ' Create a reference to the files and folders in the ZIP file
- Set objSource = objShell.NameSpace( ZipFile & "\" & FolderName ).Items( )
- Set objSourceParent = objShell.NameSpace( ZipFile & "\" & FolderName &"\").ParseName(FolderName)
- Set objParentFolder = objSourceParent.GetFolder
- set objFolder = objShell.NameSpace(TempDir)
- if ( (not objFolder is nothing) and (not objParentFolder is nothing) ) then
- objFolder.MoveHere objSource , FOF_NOCONFIRMATION
- objFolder.MoveHere objParentFolder , FOF_NOCONFIRMATION
- else
- WScript.Echo "Folder not found in the zip"
- end if
- set objFolder = nothing
- set objShell = nothing
- set objParentFolder = nothing
- set objSourceParent = nothing
- WScript.Quit
- :end_vbs
- '& if "%~2" equ "" echo usage : %~n0 zipfile folder name && exit /b 3
- '& if "%~1" equ "" echo usage : %~n0 zipfile folder name && exit /b 2
- '& md %temp%\tobedeleted
- '& set zipFile="%~f1"
- '& if not exist %zipFile% echo zip file does not exist && exit /b 1
- '& set folderName="%~2"
- '& cscript /nologo /E:vbscript %~f0 %zipFile% %folderName% "%temp%\tobedeleted"
- '& rd /s /q %temp%\tobedeleted
- '& rem pause
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement