Explorer selection?
Moderator: DosItHelp
Explorer selection?
Is there any way (extensions, etc) to use an explorer selection screen in batch to assign a full file path name to a variable?
Like this:
And when you select a file and click "open" it sets, say, %file% to the full path of the file you selected.
Any way to do this, or should I just use another code language for this?
Like this:
And when you select a file and click "open" it sets, say, %file% to the full path of the file you selected.
Any way to do this, or should I just use another code language for this?
Re: Explorer selection?
You can drag and drop a file onto a batch file.
The files you drag and drop onto a batch file becomes its command line arguments so you can access them just like you would if you were launching the batch file with a command line from the cmd prompt.
The files you drag and drop onto a batch file becomes its command line arguments so you can access them just like you would if you were launching the batch file with a command line from the cmd prompt.
Code: Select all
@echo off
echo This is the path of the file: %~f1
echo This is the file name: %~nx1
Re: Explorer selection?
You can also place the batch file in the SENDTO folder and use right click, send to the batch file.
Re: Explorer selection?
Cat wrote:Is there any way (extensions, etc) to use an explorer selection screen in batch to assign a full file path name to a variable?
There is no way to show a dialog box using pure batch. There is no "extension" for batch. All you could do is to write your own console tool in another programming language that would write the selected path to stdOut. Could be done with each language that supports WINAPI (GetOpenFileName()) or the Common Item Dialog. Not sure whether you're familiar with those programming languages.
Regards
aGerman
Re: Explorer selection?
foxidrive wrote:You can also place the batch file in the SENDTO folder and use right click, send to the batch file.
Yeah. And since it looks like they are using Vista or 7 the batch file could use the CLIP command to copy the path or file name to the clipboard.
Re: Explorer selection?
try Winnity
http://winreview.ru/winnity-dialog-vybo ... oj-stroki/ (Russian)
http://translate.google.com/translate?h ... -stroki%2F (Googlenglish)
http://winreview.ru/winnity-dialog-vybo ... oj-stroki/ (Russian)
http://translate.google.com/translate?h ... -stroki%2F (Googlenglish)
Re: Explorer selection?
I've been looking for a way long time, to get in dosbatch the multiple selection from windows explorer. I mean the multiple selection you made on selecting many files in a folder. I want this selection as parameter string and the batch should called only one time. Perhaps there is a specific function to get this multiple selection for further working on?
Re: Explorer selection?
Perotto,
place this batch file in "c:\Documents and Settings\username\SendTo\Echo filenames.bat"
Then use explorer and select several files and right click, select sendto and then click echo filenames. It will also work for folders.
place this batch file in "c:\Documents and Settings\username\SendTo\Echo filenames.bat"
Then use explorer and select several files and right click, select sendto and then click echo filenames. It will also work for folders.
Code: Select all
@echo off
:loop
if "%~1"=="" (
pause
goto :EOF
)
echo "%~1"
shift
goto :loop
Re: Explorer selection?
!k wrote:try Winnity
http://winreview.ru/winnity-dialog-vybo ... oj-stroki/ (Russian)
This seems to work in translating to english.
http://translate.google.com.au/translat ... -stroki%2F