By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,851 Members | 1,410 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,851 IT Pros & Developers. It's quick & easy.

Connecting to command prompt

P: 7
Hi all,

I m new to perl, and writing a script , in which i need to connect to the command prompt from my perl script and pass some commands like " mkdir testdir".

Is there any module available in perl to do this (in python we have os module) . I googled for it but i didnt get any help.

If any one has idea, please reply asap.
It's urgent.

thanks in advance

bunny
Feb 14 '08 #1
Share this Question
Share on Google+
5 Replies


nithinpes
Expert 100+
P: 410
Hi all,

I m new to perl, and writing a script , in which i need to connect to the command prompt from my perl script and pass some commands like " mkdir testdir".

Is there any module available in perl to do this (in python we have os module) . I googled for it but i didnt get any help.

If any one has idea, please reply asap.
It's urgent.

thanks in advance

bunny
Hi bunny,
You don't need any module for this. Just put the DOS commands within reverse quotes( ` ).


like:
Expand|Select|Wrap|Line Numbers
  1. `mkdir testdir`;
  2.  
will create the directory testdir. Reverse quote is used to execute system commands.
Feb 14 '08 #2

P: 7
Hi Nithin

Thanks for ur response, it works fine for me. :)

rgds
bunny


Hi bunny,
You don't need any module for this. Just put the DOS commands within reverse quotes( ` ).


like:
Expand|Select|Wrap|Line Numbers
  1. `mkdir testdir`;
  2.  
will create the directory testdir. Reverse quote is used to execute system commands.
Feb 15 '08 #3

KevinADC
Expert 2.5K+
P: 4,059
hopefully nobody sends the command "del c:\" to your perl script. Direct unfiltered input of system commands is very dangerous.
Feb 15 '08 #4

P: 14
Hi Bunny,

inaddition to back quotes, you can also use 'system' as follows

system('mkdir testdir');

system will execute os commands from Perl

-Nagendra Pidaparthy

Hi all,

I m new to perl, and writing a script , in which i need to connect to the command prompt from my perl script and pass some commands like " mkdir testdir".

Is there any module available in perl to do this (in python we have os module) . I googled for it but i didnt get any help.

If any one has idea, please reply asap.
It's urgent.

thanks in advance

bunny
Feb 17 '08 #5

numberwhun
Expert Mod 2.5K+
P: 3,503
H
If any one has idea, please reply asap.
It's urgent.
Also, please know that putting "Its urgent" or "Its an emergency", does not get you help any faster. Everyone here are volunteers and are not bound by the urgencies that you are under. Its best to just ask your question(s) and wait for their answer(s) that are provided.

Regards,

Moderator
Feb 17 '08 #6

Post your reply

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