I am developing an application where I need to handle drag-and-drop functionality. Specifically, I want to drag example.txt onto example.cfe, which should then run a batch file (run_cfe.bat). The batch file should receive the paths of both example.cfe and example.txt.
Currently, I’ve associated .cfe files with a batch file, but I’m facing issues with correctly passing the file paths. It seems to be able to receive the path of the example.cfe, but it doesn’t receive the path of the example.txt.
Batch File (run_cfe.bat):
@echo off
setlocal
set "TXT_FILE=%1"
set "CFE_FILE=%~dpnx0"
echo CFE File: %CFE_FILE%
echo TXT File: %TXT_FILE%
pause
endlocal
(This was generated by GPT-4o, I do not know how to program batch files. I also had more versions of this file but I lost them.)
Kayra Aça is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.