Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

launching a Perl app from DOS 1

Status
Not open for further replies.

jcarrott

Programmer
May 28, 2009
130
0
0
US
I have a Java program that I need to run when a file exists. I have written a Perl program to see if the control file is available (FileFound_sh is the Perl program. If I run it from the DOS prompt using 'perl FileFound_sh' it works. I want to run it from the Windows Task scheduler.I think I have to run something that contains 'perl FileFound_sh' in the scheduler.I created a file 'Inv1.exe' and I tried using the start command and then I tried -

LAUNCH EXTERNAL PROCESS ("D:\\Perl\\bin\\perl.exe D:\\Program Files\\OHS\\Invoice\\FileFouns_sh")

Neither worked and neither gave an error.Does anybody know what to use?
 
hmm.

well it all depends. what exactly does your perl program do? does it check to see if the file exists-- and then, if the file doesnt exist it just exits without doing anything, but if it does exist it launches the java program?

if the perl program only checks to see if the file exists then that will not be enough to do what you are wanting to do.

if the perl program checks to see if the file exists, and then if it does exist, it runs another program, then yeah, you could schedule that.

to do so, you would have to do the following.

go to start, run, type in:
services.msc

scroll down the list until you see 'Task Scheduler'. make sure it isn't disabled. it should either be automatic or manual.

make a batch file that does nothing but run your perl script.

so for example, go to the command prompt, type cd \ to go to your root directory.

type edit

inside of the edit window put in something like

c:\((path to perl program))\perl FileFound_sh

now type ALT+F, S to save the program. save it as 'whatever.bat'.

go to your control panel, go to scheduled tasks, add a scheduled task, when it asks what program you want to schedule for launch browse to your batch file. set the rest of the settings, especially time/data/credentials. see if it works. if not, go to 'Advanced' and click 'View Log' to see why not
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top