Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: Handling MSWin Script Output

by kcott (Archbishop)
on Sep 11, 2019 at 08:39 UTC ( [id://11106006]=note: print w/replies, xml ) Need Help??


in reply to Re: Handling MSWin Script Output
in thread Handling MSWin Script Output

G'day Orangutan,

Yes, I found out about the './ and '.\ early on when I tried just 'test_platform.pl'. There was a lot of output, which I won't post here; however, the last part of that had 'Suggestion [3,General]: The command test_platform.pl was not found, but does exist in the current location. Windows PowerShell does not load commands from the current location by default. If you trust this command, instead type: ".\test_platform.pl". ...'.

This is pretty much the same as UNIX-like systems when '.' is not in the path. Using my Cygwin:

$ test_platform.pl -bash: test_platform.pl: command not found $ ./test_platform.pl Platform: cygwin Executable: /home/ken/perl5/perlbrew/perls/perl-5.30.0/bin/perl

So, from PowerShell

perl test_platform.pl perl ./test_platform.pl perl .\test_platform.pl

all work identically to how I described 'perl ./test_platform.pl' in the OP. And

./test_platform.pl .\test_platform.pl

both work identically to how I described './test_platform.pl' in the OP.

Anyway, what you've described regarding how the Perl interpreter is called, does make sense, and probably answers Question 2. It's a pity, because I'd prefer not to have to type 'perl' before every script name; still, it is only for a work project and won't generally affect me as I'm normally using Cygwin.

I also noticed that you'd signed up only a fortnight ago; so please accept a belated welcome to the Monastery.

— Ken

Replies are listed 'Best First'.
Re^3: Handling MSWin Script Output
by Orangutan (Novice) on Sep 11, 2019 at 17:34 UTC

    Hello again, I think I learned something too, cmd indeed does run either call of the script in it's own window, only powershell opens the other window. And yeah if it's only for a minor convenience I suppose it might not be worth sinking too much time into :), but to throw some other suggestions out there, there does seem to be alot of possible ways to configure the powershell, or maybe wrap the script in a batch file or call from a batch file, and there also seems to be a 'legacy console' mode for powersell but I havent tried it.

    Thanks for the welcome.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11106006]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-16 05:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found