file IO, is this a bug in Powershell?

前端 未结 4 1067
南笙
南笙 2021-01-11 16:26

I have the following code in Powershell

$filePath = \"C:\\my\\programming\\Powershell\\output.test.txt\"

try
{
    $wStream = new-object IO.FileStream $file         


        
4条回答
  •  逝去的感伤
    2021-01-11 17:04

    Yet another way could be to enclose the enums in parens:

    $wStream = new-object IO.FileStream $filePath, ([System.IO.FileMode]::Append), `
        ([IO.FileAccess]::Write), ([IO.FileShare]::Read)
    

提交回复
热议问题