Upload files to "Utility Scripts"

This commit is contained in:
2025-08-05 14:48:38 +00:00
parent 5870c1a29d
commit 993f498c51
+16
View File
@@ -0,0 +1,16 @@
$Path = "C:\Temp\"
$Word_App = New-Object -ComObject Word.Application
$Format = [Microsoft.Office.Interop.Word.WdSaveFormat]::wdFormatXMLDocument
$List = Get-ChildItem -Path $Path -Recurse -File -Filter '*.doc' | Where-Object { $_.Name -match '.+\.doc$' }
Foreach ($Item in $List) {
if ($Item.Name -match '.+.doc$') {
$Document = $Word_App.Documents.Open($Item.FullName)
$Docx_Filename = "$($Item.DirectoryName)\$($Item.BaseName).docx"
$Document.SaveAs([ref]$docx_filename, [ref]$Format)
$Document.Close()
#Remove-Item -Path $Item.FullName -Force
}
}
$word_app.Quit()