I know how to use Win32::OLE to open and control IE, Excel, and other similar Windows Apps on a local or remote machine. However, I need to open a DOS window (cmd.exe) on a remote machine, use it to issue commands (dir, cd, ipconfig, etc...) and read the resulting output. I know I can do it without visibility with telnet, but I need the DOS window to be visible on the remote machine. The following works for IE, but not for cmd:
use Win32::OLE;
my $ie = Win32::OLE->new('InternetExplorer.application') or die "oops\
+n";
$ie->{visible} = 1;
$ie->Navigate("http://www.cpan.org");
my $dos = Win32::OLE->new('Cmd.application') or die "oops\n";
$dos->{visible} = 1;
I get this error:
Win32::OLE(0.1601) error 0x800401f3: "Invalid clas string" at C:\scrip
+ts\dos.pl line 14
eval {...} called at C:\dos.pl line 14
oops
If it can't be done with Win32::OLE, is there another module that will let me do this?
Thanks!
"Peace, love, and Perl...well, okay, mostly just Perl!" --me
Apprentice
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.