Welcome › Forums › General PowerShell Q&A › Copying the contents of one or more word document into another word document
This topic contains 3 replies, has 4 voices, and was last updated by
I am trying to use the following command:
gc 03.docx | sc c:\Test\04.docx
but when it creates the file 04.docx, it can't be opened by Microsoft Word. Please help.
What are you trying to achieve here. If your intend is to change extension, you should use Rename-Item cmdlet.
Get-Help Rename-Item -Online
btwn, just changing the extension doesn't make doc to docx, i believe.
Please format your code as code using the code tag button (pre) provided. Thanks.
Why don't you simply copy the complete file?
Copy-Item -Path 03.docx -Destination c:\Test\04.docx
So, docx is format file (not plain text), for a 'test' go ahead and do get-content 03.docx. What you'll notice is a LOT of gibberish to the screen.
If you want to save multiple .docx files to a new docx file, you're going to need to be able to read the document properly first. There are some conversations of doing this online.
You must be logged in to reply to this topic.