Tom's Hardware > Forum > Windows XP > Configuration & Customize > How to extract the directory from a passed filename in .ba..

How to extract the directory from a passed filename in .ba..

Forum Windows XP : Configuration & Customize - How to extract the directory from a passed filename in .ba..

Tom's Hardware: Over 1.4 million members in 6 different countries available to answer all your high-tech questions. Sign up now! Its free!
Word :    Username :           
 

Archived from groups: microsoft.public.windowsxp.customize (More info?)

 

I want to write me a little batch file that gets passed the filename of
a .tex file and then invokes LaTeX on it:

e.g. it is called as:
mybatchfile C:\foo\bar.tex

it should then first switch to the directory of the file whose name it
got passed and then execute LaTeX on it, i.e.:
--------------------------
cd C:\foo
C:\Programs\MiKTeX\bin\latex C:\foo\bar.tex
--------------------------

How can one extract the directory from a filename in a batch file, i.e.
how do I derive the substring "C:\foo" from the passed parameter
"C:\foo\bar.tex" using cmd's built-in functions?

Michael

Sponsored Links
Register or log in to remove.

Archived from groups: microsoft.public.windowsxp.customize (More info?)

 

Type call or for in Help. %~dp1

--
----------------------------------------------------------

"Michael Moser" <michael-nospam.moser@nospam.freesurf.ch> wrote in message news:Ohf2Y05VFHA.3176@TK2MSFTNGP12.phx.gbl...
>I want to write me a little batch file that gets passed the filename of
> a .tex file and then invokes LaTeX on it:
>
> e.g. it is called as:
> mybatchfile C:\foo\bar.tex
>
> it should then first switch to the directory of the file whose name it
> got passed and then execute LaTeX on it, i.e.:
> --------------------------
> cd C:\foo
> C:\Programs\MiKTeX\bin\latex C:\foo\bar.tex
> --------------------------
>
> How can one extract the directory from a filename in a batch file, i.e.
> how do I derive the substring "C:\foo" from the passed parameter
> "C:\foo\bar.tex" using cmd's built-in functions?
>
> Michael
>
>
>
>

Reply to Anonymous
Tom's Hardware > Forum > Windows XP > Configuration & Customize > How to extract the directory from a passed filename in .ba..
Go to:

There are 549 identified and unidentified users. To see the list of identified users, Click here.

Please mind

You are about to answer a thread that has been inactive for more than 6 months.
If you still wish to proceed, please ensure that your posting is original and does not duplicate or overlap any prior responses to this thread.

Add a reply Cancel
Sponsored links
  • Ask the community now
  • Publish
Ad
They won a badge
Join us in greeting them