Take Hold of your PC with PowerShell

Take Hold of your PC with PowerShell

July 24, 2015

PowerShell is a scripting language that allows users to automate actions with software installed on a computer with a Windows operating system.   Windows 7 and later systems come with Windows PowerShell Integrated Scripting Environment - a PowerShell editor.   It's possible to find many powershell scripts online that perform different basic takes in Internet Explorer, Excel, Word and other common Windows programs.   Combing the scripts together can allow you to automate repetitive tasks, and create a virtual progam of your own devising.  Below is a script I found online which will automatically convert Word documents to PDF files:

 

$wdFormatPDF = 17

$word = New-Object -ComObject word.application

$word.visible = $false

$folderpath = "c:\FooFolder\*"

$fileTypes = "*.docx","*doc"

Get-ChildItem -path $folderpath -include $fileTypes |

foreach-object `

{

$path = ($_.fullname).substring(0,($_.FullName).lastindexOf("."))

"Converting $path to pdf ..."

$doc = $word.documents.open($_.fullname)

$doc.saveas([ref] $path, [ref]$wdFormatPDF)

$doc.close()

}

$word.Quit()

 

 

To run this script follow these steps:

 

1. Begin with a folder of Word documents.

 

2. Click on the Windows icon at the far lower left of your screen and type, "PowerShell" in the search box.  Then click on 'Windows PowerShell ISE'.

 

3. In the editor that opens paste the script into the lower section and press return.

 

4. The script will run and you will see an indication in the bottom bar that it has been completed.

 

5. In the folder new PDFs will have been generated.

 

 

 

 

 

 

 

 

 

Please reload

Contact Me With Your Litigation Support Questions:

seankevinoshea@hotmail.com

  • Twitter Long Shadow

© 2015 by Sean O'Shea . Proudly created with Wix.com