locked
Powershell and pipeline RRS feed

  • Question

  • Hello I want to know if this command can be written without the pipelines(vertical lines)?

    "$u=gwmi Win32_Volume|?{$_.Label -eq'_'}|select name;cd $u.name;.\d.cmd"

    Tuesday, December 3, 2019 2:49 PM

Answers

  • Hey,Try this:

    $u=gwmi Win32_Volume -Property Label,Name -Filter "Label='_'";cd $u.name;.\d.cmd

    • Marked as answer by jbimard Tuesday, December 3, 2019 6:21 PM
    Tuesday, December 3, 2019 3:45 PM
  • Seems to me that a new keyboard would be the better answer:

    $u=(gwmi Win32_Volume -Filter "Label = '_'").Name
    cd $u.name
    .\d.cmd


    \_(ツ)_/



    • Edited by jrv Tuesday, December 3, 2019 6:06 PM
    • Marked as answer by jrv Tuesday, December 3, 2019 7:02 PM
    Tuesday, December 3, 2019 6:05 PM

All replies

  • Why?

    Live long and prosper!

    (79,108,97,102|%{[char]$_})-join''

    Tuesday, December 3, 2019 2:59 PM
  • I'm using a USB that also functions as a  keyboard and I try it to run this script in Powershell but the Latin American keyboard doesn't have a determine pipeline key

    powershell "$u=gwmi Win32_Volume|?{$_.Label -eq'_'}|select name;cd $u.name;.\d.cmd"



    Tuesday, December 3, 2019 3:12 PM
  • Hey,Try this:

    $u=gwmi Win32_Volume -Property Label,Name -Filter "Label='_'";cd $u.name;.\d.cmd

    • Marked as answer by jbimard Tuesday, December 3, 2019 6:21 PM
    Tuesday, December 3, 2019 3:45 PM
  • ...  but the Latin American keyboard doesn't have a determine pipeline key ...

    You can hold the <Alt> key type 124 on your num pad and release the <Alt> key.  ;-)

    Live long and prosper!

    (79,108,97,102|%{[char]$_})-join''

    Tuesday, December 3, 2019 3:50 PM
  • Seems to me that a new keyboard would be the better answer:

    $u=(gwmi Win32_Volume -Filter "Label = '_'").Name
    cd $u.name
    .\d.cmd


    \_(ツ)_/



    • Edited by jrv Tuesday, December 3, 2019 6:06 PM
    • Marked as answer by jrv Tuesday, December 3, 2019 7:02 PM
    Tuesday, December 3, 2019 6:05 PM