Pour les professionnels de l’informatique > Forums - Accueil > Windows PowerShell > Output changes depending upon order of commands and previous commands
Poser une questionPoser une question
 

QuestionOutput changes depending upon order of commands and previous commands

  • mardi 30 juin 2009 16:08CodeSlinger Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     A du code
    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"
    "-------------------------------------"
    
    
    

Toutes les réponses

  • mardi 30 juin 2009 18:05Marco ShawMVP, ModérateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     
    I'll try to fire up a 64-bit VM by end of week.

    Sounds familiar tough...
  • jeudi 2 juillet 2009 06:25Mervyn ZhangMSFT, ModérateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     
    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.
  • jeudi 2 juillet 2009 15:18CodeSlinger Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     
    Thanks Mervyn. I was just trying to report as a bug if that is what it is. Can you do that? Thanks, Dave
  • vendredi 3 juillet 2009 02:49Mervyn ZhangMSFT, ModérateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     
    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.