I'm trying to write a batch which can process files dropped from within a 7zip archive browser window (by dropping the files from the 7-zip window to the batch file in the windows explorer window which will result in the batch being run with the dropped file's path as its first argument).
Dropping files from a windows file explorer window works fine, but when i test this from within a 7zip archive browser window the temporary file which 7zip creates doesn't exist anymore once the batch is run.
Here's the test batch program:
if not exist "%1" echo %1 does not exist
Here's the test setup to make things clearer:
Echo outputs the message
C:\Users\...\AppData\Local\Temp\7zECF421759\test.txt does not exist
Is there a way to pin the temporary file until the end of the batch so that it is not deleted prematurely?
EDIT 1:
Found this text in the 7-zip FAQ:
Why does drag-and-drop archive extraction from 7-Zip to Explorer use temp files?
7-Zip doesn't know folder path of drop target. Only Windows Explorer knows exact drop target. And Windows Explorer needs files (drag source) as decompressed files on disk. So 7-Zip extracts files from archive to temp folder and then 7-Zip notifies Windows Explorer about paths of these temp files. Then Windows Explorer copies these files to drop target folder.
Whether or not it's possible to replicate the behavior within a batch file (or any other program which isn't windows explorer) seems to depend on how 7-zip notifies windows explorer.
