Skip to content

Instantly share code, notes, and snippets.

@aadennis
Created January 15, 2020 18:11
Show Gist options
  • Save aadennis/5175939c9561d80920e0c8f135a24438 to your computer and use it in GitHub Desktop.
Save aadennis/5175939c9561d80920e0c8f135a24438 to your computer and use it in GitHub Desktop.
The specifics differ depending on the app. Originally, this was so I could cache OneNote documents (Onenote.exe /r)
$root = "C:\OneDrive\data"
$WordExe = "C:\Program Files (x86)\Microsoft Office\root\Office16\winword.exe"
cd $root
$dir = gci -r *.docx
$dir
$dir | % {
$note = $_
$fn = $note.FullName
"Currently on $fn"
& $WordExe $fn
sleep 6
Get-Process | Where-Object -Property Name -eq "WINWORD" | kill
sleep 6
}
cd C:\PowerShell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment