On 3/20/07, Sayed, Irfan (Irfan) <[EMAIL PROTECTED]> wrote:
Hi all,

I am executing following command on windows platform in perl programme.

my $cmd1 = `set USERNAME`; but I am facing following error.

Z:\>ccperl rec_bl.pl
'USERNAME' is not recognized as an internal or external command,
operable program or batch file.

Does anybody help in how to execute windows command in perl

Please help.

Regards
Irfan.

It looks like you are trying to read an environmental variable.  The
set command is part of cmd.exe and is not an external command, luckily
Perl binds the %ENV variable to the environment.  You should be able
to say

my $user = $ENV{USERNAME};

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to