powershell - Why does the script output itself to the console? -


my script outputs console before executing script. code:

for ($i=1; $i -le 1000; $i++) {     write-host "sending request #$i"     $request = invoke-webrequest "http://localhost/test"        $random = get-random -minimum 1 -maximum 5     start-sleep -seconds $random  } 

which in powershell ise: enter image description here

what doing wrong , how fix it?

this happens when use powershell ise , run script without saving it.

essentially copies whole script console , executes there.

once save file, switch calling file , won't display whole script.

you can see first hand if execution policy set not execute scripts, because you'll able run script before saving not after (until change execution policy).


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -