Error when calling 3rd party executable from Powershell when using an IDE

后端 未结 4 1430
悲&欢浪女
悲&欢浪女 2020-11-28 23:41

I have a PowerShell script that uses du.exe (Disk Usage originally from Sysinternals) to calculate the size of directories.

If I run du c:\\Backup in th

4条回答
  •  北荒
    北荒 (楼主)
    2020-11-28 23:55

    Another way to suppress the NativeCommandError output is to convert the objects in the pipeline to strings as outlined at the bottom of this answer:

    du c:\Backup 2>&1 | %{ "$_" }
    

提交回复
热议问题