Setting a BAT to open a file BY DRAGGING THE FILE ON THE BAT
Moderator: DosItHelp
Setting a BAT to open a file BY DRAGGING THE FILE ON THE BAT
Sorry if i've already made this questions on yahoo answers, but i think this forum would give better answers.
Basically what i want to do is to make a BAT file open a file that's dragget to it or opened with it with another application
BUT VIA SUFFIX in this way:
START whatdoihavetotypehere.exe -loadbin "OPENEDFILEPATH" <<< that's the opened file
^ that's another file with a SPECIFIC path, wich is located in the same folder of the bat file
Basically what i want to do is to make a BAT file open a file that's dragget to it or opened with it with another application
BUT VIA SUFFIX in this way:
START whatdoihavetotypehere.exe -loadbin "OPENEDFILEPATH" <<< that's the opened file
^ that's another file with a SPECIFIC path, wich is located in the same folder of the bat file
Re: Setting a BAT to open a file BY DRAGGING THE FILE ON THE
The file you drag and drop onto the batch file can be referenced in the batch file as: "%~1"
Re: Setting a BAT to open a file BY DRAGGING THE FILE ON THE
yes but that doesn't tell me everything, i still don't know how can i open that specific exe file USING THOSE PARAMETERS
Re: Setting a BAT to open a file BY DRAGGING THE FILE ON THE
alesimula wrote:yes but that doesn't tell me everything, i still don't know how can i open that specific exe file USING THOSE PARAMETERS
Not sure how you would open up an exe file. It would be a binary file. What would you expect to read from opening an exe file?
Maybe I just don't understand what you want. Maybe if your description was more detailed to show a more detailed example then we could figure it out.
-
- Expert
- Posts: 1167
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: Setting a BAT to open a file BY DRAGGING THE FILE ON THE
So you want to run waffles.exe by dragging it onto the batch script and then the batch script will run
Am I reading that correctly?
Code: Select all
start waffles.exe -loadbin "<current path of waffles.exe>"
Am I reading that correctly?
Re: Setting a BAT to open a file BY DRAGGING THE FILE ON THE
ShadowThief wrote:So you want to run waffles.exe by dragging it onto the batch script and then the batch script will runCode: Select all
start waffles.exe -loadbin "<current path of waffles.exe>"
Am I reading that correctly?
NOT EXACTLY
drag potato.bin inside loader.bat
should do something like
start waffles.exe -loadbin "<current path of potato.bin>"
And remember waffles.exe is in the same directory as loader.bat, while potato.bin is in a random directory
-
- Expert
- Posts: 1167
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: Setting a BAT to open a file BY DRAGGING THE FILE ON THE
Will that same exe always be run regardless of which file is dragged onto the batch script?
Re: Setting a BAT to open a file BY DRAGGING THE FILE ON THE
Code: Select all
@If /I %~x1 Equ .bin (Start waffles.exe -loadbin "%~1")
Re: Setting a BAT to open a file BY DRAGGING THE FILE ON THE
Compo wrote:Code: Select all
@If /I %~x1 Equ .bin (Start waffles.exe -loadbin "%~1")
Problem is, this would result as waffles.exe is in the same folder as potao.bin
-
- Expert
- Posts: 1167
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: Setting a BAT to open a file BY DRAGGING THE FILE ON THE
alesimula wrote:Compo wrote:Code: Select all
@If /I %~x1 Equ .bin (Start waffles.exe -loadbin "%~1")
Problem is, this would result as waffles.exe is in the same folder as potao.bin
But you said earlier that waffles.exe is in the same folder as the batch script.
Re: Setting a BAT to open a file BY DRAGGING THE FILE ON THE
ShadowThief wrote:alesimula wrote:Compo wrote:Code: Select all
@If /I %~x1 Equ .bin (Start waffles.exe -loadbin "%~1")
Problem is, this would result as waffles.exe is in the same folder as potao.bin
But you said earlier that waffles.exe is in the same folder as the batch script.
Yes, but dragging potato.bin (wich is in a random folder) inside te bat file, will result as path is potato's path and not bat file's path
Re: Setting a BAT to open a file BY DRAGGING THE FILE ON THE
ShadowThief wrote:But you said earlier that waffles.exe is in the same folder as the batch script.
Exactly. The current working directory will be where the batch file resides. Not the directory of the file you drag onto the batch file.
Re: Setting a BAT to open a file BY DRAGGING THE FILE ON THE
Make this batch file and drop any file you want onto it.
Code: Select all
@echo off
echo This is the batch file path: "%~dp0"
echo This is the current working directory: "%CD%"
echo This is the file names path: "%~dp1"
pause
Re: Setting a BAT to open a file BY DRAGGING THE FILE ON THE
Squashman wrote:ShadowThief wrote:But you said earlier that waffles.exe is in the same folder as the batch script.
Exactly. The current working directory will be where the batch file resides. Not the directory of the file you drag onto the batch file.
facts proves the contrary: when i drag potato.bin inside the bat, it says waffle.exe doesn't exist, while it runs when poteto.bin is in the same folder as waffles.exe
-
- Expert
- Posts: 1167
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: Setting a BAT to open a file BY DRAGGING THE FILE ON THE
What happens if you say
Code: Select all
@If /I %~x1 Equ .bin (Start "%~dp0\waffles.exe" -loadbin "%~1")