So I crave for TC to do it for me.

Moderators: Hacker, petermad, Stefan2, white
Code: Select all
@echo off
rem First parameter is path to archive, second is unpack path
if -%2==- goto exit
if not exist %2 md %2
unrar.exe x %1 *.* %2
echo Press a key to kill archive
pause
del %1
:exit
cls
Code: Select all
; in Total Commander use %P%N as Parameters (without quotes). Do not set working dir to extract in folder where archive is located
#SingleInstance off
winrarPath:="d:\aamProgramme\WinRAR\WinRAR.exe"
; ask before deleting archive?
askForConfirmation:= true
archiveFile = %1%
; x: extract
winrarParameters = x "%archiveFile%"
RunWait, "%winrarPath%" %winrarParameters%
; if WinRAR exit code is 0, extraction was successful
if (ErrorLevel == 0)
{
if (askForConfirmation)
{
;4 is message box type Yes/No, 256: make 2nd button default
MsgBox, 260, delete after extract?, Extraction successful.`n`nDelete "%archiveFile%" to recycle bin?
IfMsgBox Yes
{
deleteFile(archiveFile)
}
}
else
deleteFile(archiveFile)
}
else
MsgBox, There was an error extracting %archiveFile%
deleteFile(file)
{
FileRecycle, %file%
if (ErrorLevel)
MsgBox, Error deleting "%file%"
}