且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将C#代码(大约15行代码)转换为Powershell是否容易?

更新时间:2023-02-16 21:23:13

这应该可以解决您得到的错误:

This should fix the error you're getting:

$content = get-content "C:\linktodocumenttemplate.txt"
$utf = new-object System.Text.UTF8Encoding
$newFile = $docLibrary.RootFolder.Files.Add($newDestinationFolderPath, $utf.GetBytes($content.ToString()), $true)