batch command doesn't work if called by another batch

J

jonefer

I have a batch file "A.Bat" that opens a couple of RTF's
using Microsoft Word.

Because it requires a parameter, I need to call it using
the command prompt. This works fine.

It's a hasstle though to have to open a command prompt
each time and CD to the directory that "A.Bat" is in so I
wrote another batch file that calls "A.Bat" from the
correct location and conveniently opens up a parameter
window.

However... this line in A.Bat:

"C:\Program Files\Microsoft Office\Office\winword.exe"
wordfile_~1.rtf wordfile_~2.rtf wordfile_~3.rtf

doesn't work anymore. It just says: "Bad Command"
What gives?
 
R

Ron Sommer

"C:\Program Files\Microsoft Office\Office\winword.exe"
wordfi~1.rtf wordfi~2.rtf wordfi~3.rtf
 
B

Bill James

Another option is to just add the directory that "A.Bat" is in to the Path environmental variable. Start, Control Panel, System, Advanced tab, Environmental Variables button. After adding the directory you can run a.bat from any command prompt (as long as there is not another a.bat file present in another Path directory).

--

Bill James
Microsoft MVP - Shell/User

Win9x VBScript Utilities » www.billsway.com/vbspage/
Windows Tweaks & Tips » www.billsway.com/notes_public/
 
J

jonefer

Thanks Bill,
I tried that, (added J:\Production
Eligibility\Eligibility\Load Reports) to the Environment
Variables in the systems section under "Path"

But it doesn't recognize the command in any command prompt
window.

Incidentally, the batch file that is calling A.Bat was
built on a 9x computer and has the "Program" tab in it..
with the line J:\PRODUC~2\ELIGIB~1\LOAD_R~1\A.BAT ?

This effectively prompts the user with a pop up box, but
when the string is entered. The

"C:\Program Files\Microsoft Office\Office\winword.exe"
wordfi~1.rtf wordfi~2.rtf wordfi~3.rtf"

doesn't work. Please note that it DOES work if I run it
directly from a command prompt.

jonefer

-----Original Message-----
Another option is to just add the directory that "A.Bat"
is in to the Path environmental variable. Start, Control
Panel, System, Advanced tab, Environmental Variables
button. After adding the directory you can run a.bat from
any command prompt (as long as there is not another a.bat
file present in another Path directory).
--

Bill James
Microsoft MVP - Shell/User

Win9x VBScript Utilities » www.billsway.com/vbspage/
Windows Tweaks & Tips » www.billsway.com/notes_public/

"jonefer" <[email protected]> wrote in
message news:[email protected]...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top