CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Accessing Win Command prompt(cmd) thru perl

 



vishalkbhatt
Novice

Apr 28, 2011, 1:16 AM

Post #1 of 4 (992 views)
Accessing Win Command prompt(cmd) thru perl Can't Post

Hi friends, I have just started to learn perl. I want to know that is it possible to access windows xp command prompt thru perl script ?? wat I mean is that I want to execute a command :
D:\work\0052> svn status -u
on a newly opened cmd window thru perl, then wat will be the syntax for it ? so far I m able to open a cmd and go to the directory using command in perl script.
system("start cmd.exe /k cd work/0053");
but then how to do the svn command ??
pls help me to achieve this..
thanx


rovf
Veteran

Apr 28, 2011, 1:58 AM

Post #2 of 4 (990 views)
Re: [vishalkbhatt] Accessing Win Command prompt(cmd) thru perl [In reply to] Can't Post

Two possibilities:

(1) You do the chdir within your Perl program, and then start cmd.exe /k svn status -u

(2) You put the cd and the svn command into a batch file and start this batch file


vishalkbhatt
Novice

Apr 28, 2011, 2:30 AM

Post #3 of 4 (989 views)
Re: [rovf] Accessing Win Command prompt(cmd) thru perl [In reply to] Can't Post

Thanks for reply but i did the following
system("chdir work/0053");
system("start cmd.exe /k svn status -u > D:/v.txt ");

and executed the script but the chdir command is not working
the prompt remains at D:/ drive.


rovf
Veteran

Apr 28, 2011, 3:17 AM

Post #4 of 4 (988 views)
Re: [vishalkbhatt] Accessing Win Command prompt(cmd) thru perl [In reply to] Can't Post

Of course this doesn't work. If you want to chdir within Perl, you have to do it, well, WITHIN Perl, not by shelling out.

Perl offers a chdir function. See perldoc -f chdir.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives