Is it possible to return the name of a file / program for a bat? Type by dragging it to the bat or executed by the bat, it returns the name.
Is it possible to return the name of a file / program for a bat? Type by dragging it to the bat or executed by the bat, it returns the name.
Yes, this is a simple example, it takes the parameter "set arg1 =% 1" and then shows the value "echo% arg1%".
or
It takes the path of the file you dragged "set arg1 =% 1" and then shows the path "echo% arg1%".
echo off
set arg1=%1
echo %arg1%
pause
Let's suppose you drag a txt, and want to open it in notepad for example:
echo off
set arg1=%1
start notepad %arg1%