473,320 Members | 1,572 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Executing a batch file(.bat) from a perl code

I have tried executing executing a batch file from a perl code using
system("start c:\\temp\\sample.bat")
but it is not executing ,Is there any way to execute batch file from a perl code
Feb 26 '08 #1
2 2814
nithinpes
410 Expert 256MB
I have tried executing executing a batch file from a perl code using
system("start c:\\temp\\sample.bat")
but it is not executing ,Is there any way to execute batch file from a perl code
The way you have tried should ideally work:
Expand|Select|Wrap|Line Numbers
  1. system("start c:\\temp\\sample.bat");
  2.  
Is it throwing any error? That would help to find the cause.
Though, you can alternatively use reverse quote( ` ) instead of system command.
Expand|Select|Wrap|Line Numbers
  1. `start c:\\temp\\sample.bat`;
  2.  
Feb 27 '08 #2
The way you have tried should ideally work:
Expand|Select|Wrap|Line Numbers
  1. system("start c:\\temp\\sample.bat");
  2.  
Is it throwing any error? That would help to find the cause.
Though, you can alternatively use reverse quote( ` ) instead of system command.
Expand|Select|Wrap|Line Numbers
  1. `start c:\\temp\\sample.bat`;
  2.  
Its executing fine now with
Expand|Select|Wrap|Line Numbers
  1. `C:\temp\sample.bat` 
  2.  
,but another problem is occuring.....when there is some error in the .bat file(sample.bat) the perl should not execute it,and should throw some error message,but in case of error in the .bat file also,it is executing........Is there any way to capture in the perl code that if there is some error in the sample.bat file then it should throw some error message and should not excute the .bat file
Feb 27 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: ian.irlandez | last post by:
Hey all, I'm trying to execute a bat file on the server in javascript. The javascript sits on the server as well. I'm currently using: document.location.href='testme.bat'; However the only...
1
by: John A Grandy | last post by:
somewhere in the .net framework libs , is the following intrinsically supplied 1. class-name & method that called the currently executing code 2. for overriden methods within a...
0
by: Zac | last post by:
What is the method to execute backups from batch (.bat) files on the server running SQL Server. I have tried the sqlmaint command - doesn't seem to execute, looked into the xp_sqlmaint with no luck....
1
by: idorjee | last post by:
hi all, i've been trying to write a perl cgi script to generate an html output of the blast (program) and it's parsed results on the browser. following are some of the few lines from the script. the...
3
by: poojapo | last post by:
Is it possible to execute Perl code from java script? can you explain with a snippet? I have installed apache-tomcat for the same. In which folder should I paste the html file and the Perl...
9
rajiv07
by: rajiv07 | last post by:
Hi to all, I want execute a perl program inside another perl program with passing some values to called program by calling program. Is any Idea please. Thanks in advance.
2
by: ioshonowo | last post by:
Hello. Could someone give me the command that will allow my batch program to execute an iteration of a for loop then wait 5 minutes and execute another iteration. I have tried wait and sleep but...
1
by: GOPALA | last post by:
Hi , How To Execute A Psql Commands Through Batch File(.bat). My Aim Is , Usting Batch File , Connect The Database And Then Execute The Psql Statements.
1
by: aiko27 | last post by:
Hi I would like to create a batch file (bat) where it outputs some text (either by echo or calling some other script) and append to an existing text file. However, everytime a > (or >>) is used,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.