user1125316
user1125316

Reputation: 19

Sending Windows Terminal Commands Via Perl

I am trying to use the query terminal server command, but Perl keeps coming back with this error:

    'query' is not recognized as an internal or external command,
    operable program or batch file.

If I enter the query command directly into the command prompt I am able to use it, however all of these attempts via Perl result in the above error:

    exec("query /help");
    system("query /help");
    `query /help`;

I'm guessing it has to do with the way Perl creates a new shell to send commands. Is there a way to have it send directly within the same command shell I am executing the Perl script in?

Upvotes: 0

Views: 160

Answers (1)

Sobrique
Sobrique

Reputation: 53478

Well, I've just tried it on my system with:

print system ( "query /help" );

And that works. So my guess might be - query isn't in the path when you're using perl.

Failing that though - I'd suggest trying cmd /c query /help

Upvotes: 1

Related Questions