file IO, is this a bug in Powershell?

前端 未结 4 1101
南笙
南笙 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:10

    Another way would be to use just the name of the value and let PowerShell cast it to the target type:

    New-Object IO.FileStream $filePath ,'Append','Write','Read'
    

提交回复
热议问题