Ah, I see the problem. To use those TC-internal variables in an external batch file, the have to be specified as parameters for the button you'd like to create. So they get passed to the batch file. E.g.:eugensyl wrote:%COMSPEC% /C del "%N%M"
Code: Select all
Command:
FILENAME.BAT
Parameter:
%P%N
=> So all you have to do is define the button as shown above, then in the batch file replace every %N %M and their quotation marks with %1:
Code: Select all
@echo off
echo Now, you will delete permanently the file under cursor:
echo %1
echo.
echo Press Ctrl-Break or Ctrl-C if this action is a mistake.
pause
del %1
if exist %1 goto z
echo The file under cursor was deleted.
goto final
:z
echo The file under cursor was NOT deleted.
:final
pause
But your example can also be solved without an external file. Just enter the settings for the button like this (tested with an entry in start menu, because I don't have/use any butons):
Code: Select all
Command:
%COMSPEC% /c
Parameter:
echo Now, you will delete permanently the file under cursor:&echo %P%N&echo.&echo Press Ctrl-C if this action is a mistake.&pause&del %P%N&echo.&(if not exist %P%N echo File was deleted.)&(if exist %P%N echo File was NOT deleted.)&pause
Ctrl-Break doesn't work here on my system, but Ctrl-C does (tested in Win2k SP4). Please try this with a non-important file first, which can be deleted...