473,322 Members | 1,398 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,322 software developers and data experts.

running windows batch program in perl

hi friends,

need help from you....
i have a Windows batch program..
i need to run it from a perl script.....

regards
rohit
Mar 28 '08 #1
6 2013
numberwhun
3,509 Expert Mod 2GB
hi friends,

need help from you....
i have a Windows batch program..
i need to run it from a perl script.....

regards
rohit

Sorry, I don't know the answer but hopefully one of our experts will be able to assist you.

My appologies for the delay in getting an answer to your question.

Regards,

Jeff
Apr 17 '08 #2
nithinpes
410 Expert 256MB
hi friends,

need help from you....
i have a Windows batch program..
i need to run it from a perl script.....

regards
rohit
You can use any of the following ways:
Expand|Select|Wrap|Line Numbers
  1. system("C:\\mybatch.bat");
  2.  
OR

Expand|Select|Wrap|Line Numbers
  1. system("start C:\\mybatch.bat"); ## this will open a new command window
  2.  
OR

Expand|Select|Wrap|Line Numbers
  1. exec("C:\\mybatch.bat");
  2.  
OR

Expand|Select|Wrap|Line Numbers
  1. `C:\\mybatch.bat`;  # using backticks(reverse quotes)
  2.  
If you want to capture the output, assign it to a variable. For ex:
Expand|Select|Wrap|Line Numbers
  1. @res=`C:\\mybatch.bat`; 
  2.  
Apr 21 '08 #3
Sorry, I don't know the answer but hopefully one of our experts will be able to assist you.

My appologies for the delay in getting an answer to your question.

Regards,

Jeff
no issue Jeff.
i have got the answer..
Apr 24 '08 #4
You can use any of the following ways:
Expand|Select|Wrap|Line Numbers
  1. system("C:\\mybatch.bat");
  2.  
OR

Expand|Select|Wrap|Line Numbers
  1. system("start C:\\mybatch.bat"); ## this will open a new command window
  2.  
OR

Expand|Select|Wrap|Line Numbers
  1. exec("C:\\mybatch.bat");
  2.  
OR

Expand|Select|Wrap|Line Numbers
  1. `C:\\mybatch.bat`;  # using backticks(reverse quotes)
  2.  
If you want to capture the output, assign it to a variable. For ex:
Expand|Select|Wrap|Line Numbers
  1. @res=`C:\\mybatch.bat`; 
  2.  

thanks Nitin. I know it works in unix with perl.
but whether it work in windows with active perl, i don't know.
this question was asked to me who works in windows platforn.
i told how i do it in unix platform to run a shell script within perl.
Apr 24 '08 #5
nithinpes
410 Expert 256MB
thanks Nitin. I know it works in unix with perl.
but whether it work in windows with active perl, i don't know.
this question was asked to me who works in windows platforn.
i told how i do it in unix platform to run a shell script within perl.
It works very well in Windows with Activestate perl. :)
Apr 24 '08 #6
It works very well in Windows with Activestate perl. :)
thats great. thanks.
Apr 25 '08 #7

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

Similar topics

12
by: Moosebumps | last post by:
So, after reading some messages about os.system, and looking at the popen stuff and trying it a bit, I still have not found a way to keep a command window open for several commands (on Windows...
2
by: brad | last post by:
I am new to perl and would like to know how to check the return values of a perl program in a batch file. how can I save the return value of the perl program and use it to make decisions as to...
0
by: joeted | last post by:
Hi, I am using system.diagnostic.process with the intention of running a program to communicate with a unix box: The program is "PuTTY", running from a batch script. I know it works because...
4
by: Shiraz | last post by:
Hi I'm using Visual Studio Installer to make my installer, and have not as yet figured out a straightforward way to use it to set environmental variables. Amongst the various things I tried, I'm...
11
by: news | last post by:
I've a PHP script that does some stuff, zips up some files, and starts an FTP process. I need it to do the Zip and FTP in the background and let the page finish, otherwise the user could have...
0
by: sunrt | last post by:
We have an As400 system that has program which executes batch files which resides on the SQL server 7.0 computer . Those batch files run SQL server jobs using isql. The whole idea about this is...
2
by: sunilsn | last post by:
Hi, I am newbie to perl, I hope you guys will help me resolve the challenge I am facing. I have a unix shell script on one UNIX machine say A, and a batch file on windows machine say B. Now I want...
1
shrek123
by: shrek123 | last post by:
Hi, I have to call a perl program(if it is not running) from a perl program How can I check if my program is already running or not. I somehow, didn't like the idea of using some file as tag....
3
by: chinnu2809 | last post by:
I have ten xml files (each xml file is executed in batch or telnet using the command (say) xyz.xml1, xyz.xml2 in batch !) Now instead of executing each and every xml every time , i have to write a...
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: 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: 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: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.