I want to drag and drop a file onto a batch file in order to run the below command on it. How do I go about running the command on the dropped file?
PotreeConverter.exe <dropped file> -o C:/output -p index
I want to drag and drop a file onto a batch file in order to run the below command on it. How do I go about running the command on the dropped file?
PotreeConverter.exe <dropped file> -o C:/output -p index
The path
of the file, when you drop it on the BAT
file, will be returned as a normal %1
argument.
so :
@echo off
PotreeConverter.exe "%~1" -o C:/output -p index
You can use %*
if you drop more then 1 file
Example :
@echo off
for %%a in (%*) do echo [%%a] was dropped on me
pause
Following this easy guide.
Create a batch file test.bat
with the contents
@echo off
echo The full path of the file is: %1
pause
Drag any file onto it, you will see that %1
is replaced with the full path for that file in quotes.
Now you know how to execute some command that takes a path to a file as an argument:
@echo off
some_command_that_takes_a_path_to_a_file %1