Recursos para Profesionales de TI > Página principal de foros > Windows PowerShell > Output changes depending upon order of commands and previous commands
Formular una preguntaFormular una pregunta
 

PreguntaOutput changes depending upon order of commands and previous commands

  • martes, 30 de junio de 2009 16:08CodeSlinger Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     Tiene código
    Try running the following script from a V2 PowerShell, then reverse the order of some of the commands. I am running this on PS V2 on Windows 7 RC. I thought just a weird outputting bug but according to Bob Landau on the PS newgroup, the explanation for the 2 weird output behaviours, though still a bug, is that the default formator is being changed from Format-Table to Format-List. Would be great if Microsoft took this on as a bug if it really is since I did not have good luck with the Connect site trying to report it as such.
    
    Thanks, Dave
    
    "-------------------------------------"
    "Start of PS scripting test"
    "-------------------------------------"
    
    # weirdness #1 - the output of the following commands each change depending on the order of each
    # weirdness #2 - subsequent commands do not have header information and have same format as the first
    "`nOutput from get-process..."
    get-process
    "`nOutput from dir..."
    dir
    "`nOutput from get-process..."
    get-process
    "`nOutput from dir..."
    dir
    
    "-------------------------------------"
    "End of PS scripting test"
    "-------------------------------------"
    
    
    

Todas las respuestas

  • martes, 30 de junio de 2009 18:05Marco ShawMVP, ModeradorMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     
    I'll try to fire up a 64-bit VM by end of week.

    Sounds familiar tough...
  • jueves, 02 de julio de 2009 6:25Mervyn ZhangMSFT, ModeradorMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     
    Hi,

    It seems default output format was changed between Format-List and Format-Table.

    As a workaround, try to use out-host to fix the output.

    get-process |  out-host
    dir |  out-host

    get-process |  out-host
    dir |  out-host

    Thanks

    This posting is provided "AS IS" with no warranties, and confers no rights.
  • jueves, 02 de julio de 2009 15:18CodeSlinger Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     
    Thanks Mervyn. I was just trying to report as a bug if that is what it is. Can you do that? Thanks, Dave
  • viernes, 03 de julio de 2009 2:49Mervyn ZhangMSFT, ModeradorMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     
    Hi Dave,

    Thank you for your effort. There is already a bug in our internal database. Hope PowerShell Team solves it soon.

    Thanks.

    This posting is provided "AS IS" with no warranties, and confers no rights.