Computing.Net > Forums > Programming > batch file name from selected file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

batch file name from selected file

Reply to Message Icon

Name: mainegate
Date: August 15, 2007 at 20:31:46 Pacific
OS: xp
CPU/Ram: 1 gig
Product: compaq
Comment:

So I figured out how to add a menu when someone right clicks on a .mov or .avi and then they can click and it runs a batch file. That works great but how would I go about getting the file name from the file that I right clicked from?

My menu says Convert to Blah and now it does some command line stuff based on a specific folder or file that I have to hard code. Is there a way I can get the file name and extention of the file that I right clicked on, regardless of where the file is..is there a directory\Path\%file% kind of thing?



Sponsored Link
Ads by Google

Response Number 1
Name: Razor2.3
Date: August 15, 2007 at 21:58:38 Pacific
Reply:

%~f1
Read more: FOR /? (Look for the list that starts out with %~I, and replace "I" with "1".)


0

Response Number 2
Name: mainegate
Date: August 15, 2007 at 23:36:46 Pacific
Reply:

I understand %~f1 will get the full qualified path but the question is how can I right click on a file and have that full qualified path be put into a variable so I can call it in my other command line?

Not dragging the file onto the .bat...only right clicking on the file...is this possible?


0

Response Number 3
Name: Razor2.3
Date: August 16, 2007 at 00:39:55 Pacific
Reply:

Assuming you correctly followed the instructions you posted in your context menu post? %~f1

If you want to save the name in some sort of list, or in some sort of environment variable (for another program/script), then you'll have to write a script to do that.


0

Response Number 4
Name: mainegate
Date: August 16, 2007 at 04:06:06 Pacific
Reply:

It works. I actually had the code already and didn't realize it. Thanks for your patience.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: batch file name from selected file

Make directories from file name and move file www.computing.net/answers/programming/make-directories-from-file-name-and-move-file/19988.html

batch file name(s) in memory? www.computing.net/answers/programming/batch-file-names-in-memory/15656.html

Batch - Get variable from text file www.computing.net/answers/programming/batch-get-variable-from-text-file/17052.html