aspose file tools*
The moose likes General Computing and the fly likes Open PDF files from a batch program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » General Computing
Bookmark "Open PDF files from a batch program" Watch "Open PDF files from a batch program" New topic
Author

Open PDF files from a batch program

Sudhanshu Mishra
Ranch Hand

Joined: May 28, 2011
Posts: 217

Hi all,
I just wrote a batch file which will open a PDF document.

openpdf.bat

@echo off
start "path to my pdf file reader" %1
exit

Now,I made all my PDF files open with openpdf.bat as the default application.When I try to open any PDF file with this batch file,unlimited numbers of cmd windows open and close indefinitly.
I need help from you all on this topic if any one does Batch programming or has any idea about this problem.

Thanks....
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5827
    
    7

Is "path to my pdf file reader" an executable (.exe file) or a .bat file or something else? It would appear that your "pdf file reader" execs a command to Windows to open the .pdf file, which causes Windows to run your script, which calls the "pdf file reader" which execs a command Windows to open the .pdf file, which causes (you get the idea). If this is happening, then the "pdf file reader" is not the real reader but rather a launcher of the reader.


JBoss In Action
Sudhanshu Mishra
Ranch Hand

Joined: May 28, 2011
Posts: 217

Hi Peter,
Thanks for the reply.
The "path to PDF reader" is teh path to my Foxit PDF reader and is an .exe.But I ahve noe figured a way out.
The syntax to launch the command is :
start "" "path to the pdf reader(.exe)" "file name"
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3610
    
  60

Why don't you associate the FoxIt reader with PDF files directly? You could still open PDF files from a command line (batch file), file associations are processed there too.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Open PDF files from a batch program