Nicola,
PSC1 is the extension for a PowerShell console files will PS1 is the
extension for the powershell script file.
What you wrote is a script, so should be saved in a ps1 file.
PSC1 is a xml like file containing information on what snapins to load when
powershell is started (think similar to MMC console files)
Btw, the behavior you saw is actually a bug, We are not catching parse
errors in PSC1 correctly.
--
Abhishek Agrawal [MSFT]
PowerShell Team
http://spaces.msn.com/abhishek225
Microsoft Corporation
This posting is provided "AS IS" with no warranties, and confers no rights.
"Nicola Attico" <Nicola
Attico@discussions.microsoft.com> wrote in message
news:B30EDB76-55E3-4C20-A0F2-1618A4D190CE@microsoft.com...
> This is maybe a dumb question, but I don't understand
>
> I've a very dummy psc1 script myscript.psc1 on C:\ that contains an
> endless
> loop (or what I suppose to be an endless loop...)
>
> $i=0
> while ($i -ge 0) {$i++;write-host $i}
>
> PS C:\> $i=0
> PS C:\> while ($i -ge 0) {$i++;write-host $i}
> 1
> 2
> 3
> 4
> ...
>
>
> If I try to execute from the cmd prompt or from the PS prompt as
> CMD C:\>powershell.exe .\myscript.psc1
> or
> PS C:\>powershell.exe .\myscript.psc1
>
> a PS windows is open for a millisecond but it's closed immediately.
> Can you please explain me what's going on?
>
> Thanks in advance,
>
> Nicola Attico
>
>