Note that there are some explanatory texts on larger screens.

plurals
  1. PODifferent behaviour of commands in a script and the on the command line
    text
    copied!<p>Why do I get different outputs if I execute the following two commands in script and on the command line?</p> <pre><code>ps dir </code></pre> <p>Is there an automatic pipe behaviour?</p> <p>Here is the output from the two commands (outputs shortened):</p> <pre><code>PS C:\Users\Robzzz&gt; ps Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName ------- ------ ----- ----- ----- ------ -- ----------- 682 73 73040 62340 423 2,31 8464 iexplore 424 15 6332 6024 62 884 svchost PS C:\Users\Robzzz&gt; dir Mode LastWriteTime Length Name ---- ------------- ------ ---- d-r-- 23.09.2013 09:24 Contacts d-r-- 03.12.2013 15:30 Desktop </code></pre> <p>Here is the output from the script (outputs shortened):</p> <pre><code>PS C:\Users\Robzzz&gt; .\psdir.ps1 Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName ------- ------ ----- ----- ----- ------ -- ----------- 682 73 73040 62340 423 2,31 8464 iexplore 424 15 6332 6024 62 884 svchost PSPath : Microsoft.PowerShell.Core\FileSystem::C:\Users\Robzzz\Contacts PSParentPath : Microsoft.PowerShell.Core\FileSystem::C:\Users\Robzzz PSChildName : Contacts PSDrive : C PSProvider : Microsoft.PowerShell.Core\FileSystem PSIsContainer : True Name : Contacts Parent : Robzzz Exists : True Root : C:\ FullName : C:\Users\Robzzz\Contacts Extension : CreationTime : 02.01.2012 09:38:38 CreationTimeUtc : 02.01.2012 08:38:38 LastAccessTime : 02.01.2012 09:38:38 LastAccessTimeUtc : 02.01.2012 08:38:38 LastWriteTime : 23.09.2013 09:24:09 LastWriteTimeUtc : 23.09.2013 07:24:09 Attributes : ReadOnly, Directory BaseName : Contacts Mode : d-r-- PSPath : Microsoft.PowerShell.Core\FileSystem::C:\Users\Robzzz\Desktop PSParentPath : Microsoft.PowerShell.Core\FileSystem::C:\Users\Robzzz PSChildName : Desktop PSDrive : C PSProvider : Microsoft.PowerShell.Core\FileSystem PSIsContainer : True Name : Desktop Parent : Robzzz Exists : True Root : C:\ FullName : C:\Users\Robzzz\Desktop Extension : CreationTime : 02.01.2012 09:36:02 CreationTimeUtc : 02.01.2012 08:36:02 LastAccessTime : 03.12.2013 15:30:08 LastAccessTimeUtc : 03.12.2013 14:30:08 LastWriteTime : 03.12.2013 15:30:08 LastWriteTimeUtc : 03.12.2013 14:30:08 Attributes : ReadOnly, Directory BaseName : Desktop Mode : d-r-- </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload