| Thread Closed |
Creating Batch Files |
Share Thread |
| Nov12-03, 08:05 PM | #1 |
|
|
Creating Batch Files
Hi guys,
I am trying to create a batch file to help automate me creating dvi and pdf files from tex files. I'm in a windows xp environment. I have set up a batch file that asks the user whether they want to create a pdf file or a dvi file for output and then opens the command line editor: Code:
@echo off @title Create dvi-pdf Files @set /p type=dvi or pdf?: @cls echo Type: texify --clear --src [Filename] @%SystemRoot%\system32\cmd.exe The command prompt opens like I said: Code:
C:\Temp\ Code:
C:\Temp\texify --clear --src Temp.tex |
| Nov12-03, 08:34 PM | #2 |
|
Recognitions:
|
Try this - http://www.microsoft.com/technet/tre...docs/batch.asp
I haven't written batch files for windows in the longest time. Linux command shells are definitely a lot more powerfull. |
| Nov12-03, 09:24 PM | #3 |
|
|
Thanx dduardo,
I had already found that link though. I have made progress. The batch file asks the user for the name of the file and whether they want pdf or dvi putput, then they are taken to the command prompt witht the current path displayed, all they then have to do is type in the variable name for the output and away it goes! It's actually more labour intensive to run the batch file than to typw it in directly. But I know this will work eventuially. I have put a link to the batch file in the context menu for any tex file, so that is good. However it makes asking for the filename stupid really, but I can't work out how to let the batch file know which file they clicked on. I still can't get the batch file to automatically run the thing either, it seems silly that I have to type a variable name into the command promt to run it. |
| Nov12-03, 09:31 PM | #4 |
|
Recognitions:
|
Creating Batch Files
I'm not sure about windows, but you could try
cmd32.exe %foo where foo is the variable you want to use. If you want to execute a command, just have the batch file call it directly. |
| Nov12-03, 09:41 PM | #5 |
|
|
I just discovered the pipe command "|" which uses the output of one command as the iput of another. Just what I needed to make the batch file work automatically once I've given it data. =]
So now all I do is input the file name and output type, and away it goes. Now all I need to do is work out how I can find out the filename automatically, after all I am clicking the context menu of a particlular file. |
| Nov13-03, 09:38 PM | #6 |
|
|
Well, I can't work out how to find the identity of the file that was clicked. I know there must be a way, but I can't seee it yet. Anyone have any ideas at all?
|
| Nov13-03, 10:20 PM | #7 |
|
Recognitions:
|
|
| Nov15-03, 08:31 PM | #8 |
|
|
"C:\My Documents\Test.tex" I want it simply to send "Test.tex" as the filename. Can I force the DDE to send only the local filename? Or if not is there a way to have the batch file erase the earlier path, which I know in advance because I keep all my tex files in the one directory? |
| Nov16-03, 12:04 AM | #9 |
|
Recognitions:
|
I'm not sure.
If you were using Unix, I'd recommend having the script strip out the pathname using sed or perl. You can probably do something similar. |
| Nov16-03, 01:39 AM | #10 |
|
|
Yeah, I'm starting to see the benefits of linux. I always new it was useful, as we use it at uni. But now I'm seeing the beneifts for everyday use as well.
I'm sure there us a way to write up a simple c++ exe or dll to take the file type and append it as necessary, just need to work out how to send the info in the batch file to the exe and then back to the batch file. |
| Nov16-03, 01:59 AM | #11 |
|
|
Okay, problem completely solved. [:))]
I found some new commands I didn't know about, that allow you to pick out the useful bits of the file path. |
| Thread Closed |
Similar discussions for: Creating Batch Files
|
||||
| Thread | Forum | Replies | ||
| Batch file | Computing & Technology | 2 | ||
| Matlab and Batch mode | Math & Science Software | 2 | ||
| batch distillation | Materials & Chemical Engineering | 3 | ||
| Creating PDF Files from Other Formats | Computing & Technology | 10 | ||
| more batch files | Computing & Technology | 0 | ||