Forums before death by AOL, social media and spammers... "We can't have nice things"
|    alt.msdos.batch.nt    |    Fun with Windows NT batch files    |    68,980 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 67,000 of 68,980    |
|    JJ to paul.hermeneutic@gmail.com    |
|    Re: -Command does not run    |
|    05 Aug 17 23:03:46    |
   
   From: jj4public@vfemail.net   
      
   On Fri, 4 Aug 2017 07:52:44 -0700 (PDT), paul.hermeneutic@gmail.com wrote:   
   > Running the following from cmd.exe appears to do nothing. No output. No   
   error message.   
   >   
   > C:>powershell -NoProfile -Command "& { Get-ChildItem -Path 'C:/src/t/' ^|   
   Remove-Item -Recurse -WhatIf }"   
   >   
   > Removing the invocation operator appears to simply make the command be   
   printed.   
   >   
   > C:>powershell -NoProfile -Command "{ Get-ChildItem -Path 'C:/src/t/' ^|   
   Remove-Item -Recurse -WhatIf }"   
   > Get-ChildItem -Path 'C:/src/t/' ^| Remove-Item -Recurse -WhatIf   
   >   
   > The pipe (VERTICAL BAR) character is escaped. What's going on here?   
      
   Because the escape character (^) is within double-quotes. The escape   
   character is passed as is to the PowerShell's command line. Thus the actual   
   command executed in PowerShell is:   
      
   & { Get-ChildItem -Path 'C:/src/t/' ^| Remove-Item -Recurse -WhatIf }   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca