# Execute xelatex

My xelatex application in "C" directory.

My Tex file is in "D" Directory.

How can I run my tex file in "D" Drive?

and cmd prompt?

-
At least provide some detail on the operating system that you're using, as well as the location (folder) of your xelatex installation. My answer below is based on a suggestion that you're running Windows. –  Werner Jul 28 '11 at 6:32
The TeX Live installer should have added `xelatex` (and other tex-related executables) to your path, so that they should be accessible by just typing their name. Did you try that? For example `tex --version` should workd regardless of your current directory. If this is not the case, please provide more information about the way you installed TeX Live. If the installation went badly, it's probably better to reinstall than to try fixing the `PATH` manually, since probably other things are borken too. –  mpg Jul 28 '11 at 10:59
By the way, the latex-project tag seems hardly relevant to me. –  mpg Jul 28 '11 at 11:02

You need to append "the path to your TeX distribution" to `PATH` environment variable. To do so, follow the following steps:

1. Open Windows Explorer (not Internet Explorer), and search for `Control Panel\All Control Panel Items\System`. The shortcut is `Win+Break` (pressing and holding the `Windows Flag` button followed by pressing `Break` button).

2. Click `Advanced system settings`.

3. Click `Environment Variables...`

4. You will see 2 sections, one for User Variables and the other one for System Variables. For the sake of convenience, concentrate on the `System variables` section, locate `Path` and double click.

5. Depending on your TeX distribution path, append `;` followed by your TeX distribution path to the end of `Variable value:`. For example, if your TeX distribution path is `C:\Program Files\texlive\2011\bin\`, then append `;C:\Program Files\texlive\2011\bin\` to the end of `Variable value:` as the following figure.

6. Confirm the changes by clicking OK buttons. Done! Now you can invoke `xelatex` from any directory as follows.

-

Assuming you are running Windows (since you mention 'cmd prompt'), you should be able to execute

``````C:\>xelatex D:\myfile.tex
``````

If Windows outputs

``````'xelatex' is not recognized as an internal or external command,
operable program or batch file.
``````

then you have two options. Either set your Windows path environment variable. The way this is done varies depending on your system, so see some guidelines depending on whether you are running Windows 2000, XP, Vista or 7. Alternatively, you can expand the entire directory where your `xelatex` installation is located, for example:

``````"C:\Program Files\texlive\2011\bin\xelatex" D:\myfile.tex
``````

Note that you need to use quotes `""` if your directory structures contain spaces. If your LaTeX file is not in the `D:\` root directory/folder, then you'll have to include the entire path, as above, making sure you use quotes if the path contains spaces:

``````C:\>xelatex "D:\Documents and Settings\User\myfile.tex"
``````
-