raj esh wrote:
> Dear Guru's,
>  
> Here is my sample script...which i am running on windows.
>  
> use strict;
> use warnings;
>  
> my $result = system ( "date");
>  
> Now Date command returns me one more command prompt on which i have to 
> enter current date(means need to enter another command) how do i enter 
> one more command.
>  
> Please help me gurus.
>  
> Is their any module which can help me ??
>  
> I have checked perldoc -q system, perldoc -q command. These are little 
> confusing . I will surely recheck these if the answer lies with in these.
>  
> Correct me if i am not clear on mentioned my problem.

Do you want to get the date or set the date ?

use time, localtime, gmtime or Win32::API (GetSystemTime) for getting the
date depending on what you need.  To get with your system call above, add
the /T switch and use backticks to get returned date:
        my $result = `cmd /C date /T`;
        print "result=$result\n";

Setting the time using shell out:

        my $new_time_str fmt = '00:01:02';
        system "cmd /C time $new_time_str";

Setting date would be similar.

Or you can set using Win32::API SetSystemTime call.

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to