Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Open PDF files from a batch program

 
Sudhanshu Mishra
Ranch Hand
Posts: 238
1
Eclipse IDE Fedora Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Sudhanshu Mishra
Ranch Hand
Posts: 238
1
Eclipse IDE Fedora Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic