Windows XP Community - XPHeads



Driver Scanner

Batch - removing the path from %1

microsoft.public.windowsxp.help_and_support




Recommended Fix - Fix Vista Errors and Optimize Performance


Driver Scanner 2009 - Free Scan Now
Reply
  #1 (permalink)  
Old 07-26-2008, 07:23 AM
M Bourgon
 
Posts: n/a
Batch - removing the path from %1
Very basic, newbie batch question.
I am creating a batch file for Windows that will take the file dropped
upon it (the %1), and get the actual filename without the extension.

What I'm trying to run is ffmpeg, setting the output file to be a
different folder & filename than the input. So it would be something
like:
ffmpeg -i "%1" -f mp4 -title "HereIWantTheBaseFilename" -vcodec copy -
acodec copy "D:\holding_area\HereIWantTheBaseFilename.mp4"

So when I drop the file on it, which would invoke:
test.bat c:\my\stuff\test.avi
Once done, I'd wind up with file D:\holding_area\test.mp4

I know how I'd do it in SQL (REVERSE the variable, find the first
backslash, do the same to figure out where the "." is, SUBSTRING it to
a variable, and voila), but I have no idea where to start with a batch
file.

Any help greatly appreciated.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-26-2008, 12:55 PM
Bill Blanton
 
Posts: n/a
Re: Batch - removing the path from %1

"M Bourgon" <bourgon@gmail.com> wrote in message news:df646549-67d8-40f1-b749-8e15248b0c9c@26g2000hsk.googlegroups.com...
> Very basic, newbie batch question.
> I am creating a batch file for Windows that will take the file dropped
> upon it (the %1), and get the actual filename without the extension.
>
> What I'm trying to run is ffmpeg, setting the output file to be a
> different folder & filename than the input. So it would be something
> like:
> ffmpeg -i "%1" -f mp4 -title "HereIWantTheBaseFilename" -vcodec copy -
> acodec copy "D:\holding_area\HereIWantTheBaseFilename.mp4"
>
> So when I drop the file on it, which would invoke:
> test.bat c:\my\stuff\test.avi
> Once done, I'd wind up with file D:\holding_area\test.mp4


Try;

@echo off
for %%F in (%1) do set BASENAME=%%~nF
echo D:\holding_area\%BASENAME%.mp4
pause


type
FOR /?
at the cmd prompt for more information.



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 07-26-2008, 02:07 PM
M Bourgon
 
Posts: n/a
Re: Batch - removing the path from %1
On Jul 26, 7:55 am, "Bill Blanton" <bblan...@REMOVEmagicnet.net>
wrote:
> "M Bourgon" <bour...@gmail.com> wrote in messagenews:df646549-67d8-40f1-b749-8e15248b0c9c@26g2000hsk.googlegroups.com...
> > Very basic, newbie batch question.
> > I am creating a batch file for Windows that will take the file dropped
> > upon it (the %1), and get the actual filename without the extension.

>
> > What I'm trying to run is ffmpeg, setting the output file to be a
> > different folder & filename than the input. So it would be something
> > like:
> > ffmpeg -i "%1" -f mp4 -title "HereIWantTheBaseFilename" -vcodec copy -
> > acodec copy "D:\holding_area\HereIWantTheBaseFilename.mp4"

>
> > So when I drop the file on it, which would invoke:
> > test.bat c:\my\stuff\test.avi
> > Once done, I'd wind up with file D:\holding_area\test.mp4

>
> Try;
>
> @echo off
> for %%F in (%1) do set BASENAME=%%~nF
> echo D:\holding_area\%BASENAME%.mp4
> pause
>
> type
> FOR /?
> at the cmd prompt for more information.


Wow. I had no idea the FOR command would do all that. MANY thanks!

M
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 08:27 PM.




Recommended Download



Design by Vjacheslav Trushkin for phpBBStyles.com.
Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74