Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Word2AnyInstall.ps1
- #This script will install context menus on .DOC,.DOCX,.RTF,.PDF,.HTM,.HTML,.ODT,.XML,.XPS files to convert them to different # format using MS Word
- # Right-click any file in these extensions and you will get a menu abiove "Properties" use it
- # An MSI-based (not Click-To-Run) installation of MS Office is required, will work for Office 2007+ versions and even # Unactivated versions will work too
- # While conversion, just make sure that MS Word is not Open and please don't occupy C:\bin directory where files will be kept
- $currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
- if( -not ($currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)))
- {
- Write-Host "Running Admin Shell, Please wait....."
- Start-Sleep -Seconds 1
- Start-Process powershell.exe -ArgumentList "-ExecutionPolicy Bypass -File `"$($MyInvocation.MyCommand.Path)`"" -Verb RunAs
- Exit 0
- }
- function Install {
- If (!(Test-Path C:\bin)){
- New-Item C:\bin -Type Directory
- }
- @'
- Param(
- [System.IO.Fileinfo]$Source,
- [String]$Format
- )
- $arrFileExt = @{
- "doc" = 0
- "docx" = 0
- "htm" = 8
- "html" = 8
- "odt" = 23
- "pdf" = 17
- "rtf" = 6
- "txt" = 4
- "xml" = 19
- "xps" = 18
- }
- $myFileType = $arrFileExt."$Format"
- $myFileName = $Source.Basename
- $myFileExt = "." + $Format
- $toSave = Split-Path "$Source"
- $myOutputFile = $toSave + "\" + $myFileName + $myFileExt
- $objWord = New-Object -COMObject "Word.Application"
- $objWord.Visible = $False
- $objWord.Documents.Open([string]$Source) | Out-Null
- $objDoc = $objWord.ActiveDocument
- $objDoc.SaveAs("$myOutputFile",$myFileType) | Out-Null
- $objDoc.Close() | Out-Null
- '@ | Set-Content C:\bin\Word2Any.ps1
- @'
- Windows Registry Editor Version 5.00
- [HKEY_CLASSES_ROOT\Word.Document.12\shell\ConvertTo]
- "MUIVerb"="Convert To"
- "Position"="Bottom"
- "SubCommands"=""
- [HKEY_CLASSES_ROOT\Word.Document.12\shell\ConvertTo\shell]
- [HKEY_CLASSES_ROOT\Word.Document.12\shell\ConvertTo\shell\001DOC]
- "MUIverb"="Word document 1997-2003 (DOC)"
- "Icon"="%ProgramFiles%\\Microsoft Office\\Office15\\WINWORD.exe,-2"
- [HKEY_CLASSES_ROOT\Word.Document.12\shell\ConvertTo\shell\001DOC\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"doc\""
- [HKEY_CLASSES_ROOT\Word.Document.12\shell\ConvertTo\shell\002DOCX]
- "MUIVerb"="Word document 2007-2019 (DOCX)"
- "Icon"="%ProgramFiles%\\Microsoft Office\\Office15\\WINWORD.exe"
- [HKEY_CLASSES_ROOT\Word.Document.12\shell\ConvertTo\shell\002DOCX\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"docx\""
- [HKEY_CLASSES_ROOT\Word.Document.12\shell\ConvertTo\shell\003PDF]
- "MUIVerb"="Portable Document Format (PDF)"
- "Icon"="C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe,13"
- [HKEY_CLASSES_ROOT\Word.Document.12\shell\ConvertTo\shell\003PDF\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"pdf\""
- [HKEY_CLASSES_ROOT\Word.Document.12\shell\ConvertTo\shell\004RTF]
- "MUIVerb"="Rich Text Format (RTF)"
- "Icon"="shell32.dll,1"
- [HKEY_CLASSES_ROOT\Word.Document.12\shell\ConvertTo\shell\004RTF\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"rtf\""
- [HKEY_CLASSES_ROOT\Word.Document.12\shell\ConvertTo\shell\005ODT]
- "MUIVerb"="Open Document Text (ODT)"
- "Icon"="C:\\Program Files\\Windows NT\\Accessories\\wordpad.exe,3"
- [HKEY_CLASSES_ROOT\Word.Document.12\shell\ConvertTo\shell\005ODT\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"odt\""
- [HKEY_CLASSES_ROOT\Word.Document.12\shell\ConvertTo\shell\006TXT]
- "MUIVerb"="Plain Text File (TXT)"
- "Icon"="shell32.dll,70"
- [HKEY_CLASSES_ROOT\Word.Document.12\shell\ConvertTo\shell\006TXT\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"txt\""
- [HKEY_CLASSES_ROOT\Word.Document.12\shell\ConvertTo\shell\007HTM]
- "MUIVerb"="HTML webpage (HTM)"
- "Icon"=hex(2):43,00,3a,00,5c,00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,20,\
- 00,46,00,69,00,6c,00,65,00,73,00,5c,00,49,00,6e,00,74,00,65,00,72,00,6e,00,\
- 65,00,74,00,20,00,45,00,78,00,70,00,6c,00,6f,00,72,00,65,00,72,00,5c,00,69,\
- 00,65,00,78,00,70,00,6c,00,6f,00,72,00,65,00,2e,00,65,00,78,00,65,00,2c,00,\
- 35,00,00,00
- [HKEY_CLASSES_ROOT\Word.Document.12\shell\ConvertTo\shell\007HTM\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"htm\""
- [HKEY_CLASSES_ROOT\Word.Document.12\shell\ConvertTo\shell\008HTML]
- "MUIverb"="HTML webpage ()HTML)"
- "Icon"="C:\\Program Files\\Internet Explorer\\iexplore.exe,17"
- [HKEY_CLASSES_ROOT\Word.Document.12\shell\ConvertTo\shell\008HTML\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"html\""
- [HKEY_CLASSES_ROOT\Word.Document.12\shell\ConvertTo\shell\009XML]
- "MUIVerb"="XML File (XML)"
- "Icon"="ieframe.dll,2"
- [HKEY_CLASSES_ROOT\Word.Document.12\shell\ConvertTo\shell\009XML\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"xml\""
- [HKEY_CLASSES_ROOT\Word.Document.12\shell\ConvertTo\shell\010XPS]
- "MUIVerb"="XPS File (XPS)"
- "Icon"="D:\\Windows\\System32\\xpsrchvw.exe,2"
- [HKEY_CLASSES_ROOT\Word.Document.12\shell\ConvertTo\shell\010XPS\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"xps\""
- [HKEY_CLASSES_ROOT\Word.Document.8\shell\ConvertTo]
- "MUIVerb"="Convert To"
- "Position"="Bottom"
- "SubCommands"=""
- [HKEY_CLASSES_ROOT\Word.Document.8\shell\ConvertTo\shell]
- [HKEY_CLASSES_ROOT\Word.Document.8\shell\ConvertTo\shell\001DOC]
- "MUIverb"="Word document 1997-2003 (DOC)"
- "Icon"="%ProgramFiles%\\Microsoft Office\\Office15\\WINWORD.exe,-2"
- [HKEY_CLASSES_ROOT\Word.Document.8\shell\ConvertTo\shell\001DOC\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"doc\""
- [HKEY_CLASSES_ROOT\Word.Document.8\shell\ConvertTo\shell\002DOCX]
- "MUIVerb"="Word document 2007-2019 (DOCX)"
- "Icon"="%ProgramFiles%\\Microsoft Office\\Office15\\WINWORD.exe"
- [HKEY_CLASSES_ROOT\Word.Document.8\shell\ConvertTo\shell\002DOCX\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"docx\""
- [HKEY_CLASSES_ROOT\Word.Document.8\shell\ConvertTo\shell\003PDF]
- "MUIVerb"="Portable Document Format (PDF)"
- "Icon"="C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe,13"
- [HKEY_CLASSES_ROOT\Word.Document.8\shell\ConvertTo\shell\003PDF\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"pdf\""
- [HKEY_CLASSES_ROOT\Word.Document.8\shell\ConvertTo\shell\004RTF]
- "MUIVerb"="Rich Text Format (RTF)"
- "Icon"="shell32.dll,1"
- [HKEY_CLASSES_ROOT\Word.Document.8\shell\ConvertTo\shell\004RTF\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"rtf\""
- [HKEY_CLASSES_ROOT\Word.Document.8\shell\ConvertTo\shell\005ODT]
- "MUIVerb"="Open Document Text (ODT)"
- "Icon"="C:\\Program Files\\Windows NT\\Accessories\\wordpad.exe,3"
- [HKEY_CLASSES_ROOT\Word.Document.8\shell\ConvertTo\shell\005ODT\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"odt\""
- [HKEY_CLASSES_ROOT\Word.Document.8\shell\ConvertTo\shell\006TXT]
- "MUIVerb"="Plain Text File (TXT)"
- "Icon"="shell32.dll,70"
- [HKEY_CLASSES_ROOT\Word.Document.8\shell\ConvertTo\shell\006TXT\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"txt\""
- [HKEY_CLASSES_ROOT\Word.Document.8\shell\ConvertTo\shell\007HTM]
- "MUIVerb"="HTML webpage (HTM)"
- "Icon"=hex(2):43,00,3a,00,5c,00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,20,\
- 00,46,00,69,00,6c,00,65,00,73,00,5c,00,49,00,6e,00,74,00,65,00,72,00,6e,00,\
- 65,00,74,00,20,00,45,00,78,00,70,00,6c,00,6f,00,72,00,65,00,72,00,5c,00,69,\
- 00,65,00,78,00,70,00,6c,00,6f,00,72,00,65,00,2e,00,65,00,78,00,65,00,2c,00,\
- 35,00,00,00
- [HKEY_CLASSES_ROOT\Word.Document.8\shell\ConvertTo\shell\007HTM\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"htm\""
- [HKEY_CLASSES_ROOT\Word.Document.8\shell\ConvertTo\shell\008HTML]
- "MUIverb"="HTML webpage ()HTML)"
- "Icon"="C:\\Program Files\\Internet Explorer\\iexplore.exe,17"
- [HKEY_CLASSES_ROOT\Word.Document.8\shell\ConvertTo\shell\008HTML\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"html\""
- [HKEY_CLASSES_ROOT\Word.Document.8\shell\ConvertTo\shell\009XML]
- "MUIVerb"="XML File (XML)"
- "Icon"="ieframe.dll,2"
- [HKEY_CLASSES_ROOT\Word.Document.8\shell\ConvertTo\shell\009XML\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"xml\""
- [HKEY_CLASSES_ROOT\Word.Document.8\shell\ConvertTo\shell\010XPS]
- "MUIVerb"="XPS File (XPS)"
- "Icon"="D:\\Windows\\System32\\xpsrchvw.exe,2"
- [HKEY_CLASSES_ROOT\Word.Document.8\shell\ConvertTo\shell\010XPS\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"xps\""
- [HKEY_CLASSES_ROOT\Word.RTF.8\shell\ConvertTo]
- "MUIVerb"="Convert To"
- "Position"="Bottom"
- "SubCommands"=""
- [HKEY_CLASSES_ROOT\Word.RTF.8\shell\ConvertTo\shell]
- [HKEY_CLASSES_ROOT\Word.RTF.8\shell\ConvertTo\shell\001DOC]
- "MUIverb"="Word document 1997-2003 (DOC)"
- "Icon"="%ProgramFiles%\\Microsoft Office\\Office15\\WINWORD.exe,-2"
- [HKEY_CLASSES_ROOT\Word.RTF.8\shell\ConvertTo\shell\001DOC\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"doc\""
- [HKEY_CLASSES_ROOT\Word.RTF.8\shell\ConvertTo\shell\002DOCX]
- "MUIVerb"="Word document 2007-2019 (DOCX)"
- "Icon"="%ProgramFiles%\\Microsoft Office\\Office15\\WINWORD.exe"
- [HKEY_CLASSES_ROOT\Word.RTF.8\shell\ConvertTo\shell\002DOCX\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"docx\""
- [HKEY_CLASSES_ROOT\Word.RTF.8\shell\ConvertTo\shell\003PDF]
- "MUIVerb"="Portable Document Format (PDF)"
- "Icon"="C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe,13"
- [HKEY_CLASSES_ROOT\Word.RTF.8\shell\ConvertTo\shell\003PDF\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"pdf\""
- [HKEY_CLASSES_ROOT\Word.RTF.8\shell\ConvertTo\shell\004RTF]
- "MUIVerb"="Rich Text Format (RTF)"
- "Icon"="shell32.dll,1"
- [HKEY_CLASSES_ROOT\Word.RTF.8\shell\ConvertTo\shell\004RTF\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"rtf\""
- [HKEY_CLASSES_ROOT\Word.RTF.8\shell\ConvertTo\shell\005ODT]
- "MUIVerb"="Open Document Text (ODT)"
- "Icon"="C:\\Program Files\\Windows NT\\Accessories\\wordpad.exe,3"
- [HKEY_CLASSES_ROOT\Word.RTF.8\shell\ConvertTo\shell\005ODT\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"odt\""
- [HKEY_CLASSES_ROOT\Word.RTF.8\shell\ConvertTo\shell\006TXT]
- "MUIVerb"="Plain Text File (TXT)"
- "Icon"="shell32.dll,70"
- [HKEY_CLASSES_ROOT\Word.RTF.8\shell\ConvertTo\shell\006TXT\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"txt\""
- [HKEY_CLASSES_ROOT\Word.RTF.8\shell\ConvertTo\shell\007HTM]
- "MUIVerb"="HTML webpage (HTM)"
- "Icon"=hex(2):43,00,3a,00,5c,00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,20,\
- 00,46,00,69,00,6c,00,65,00,73,00,5c,00,49,00,6e,00,74,00,65,00,72,00,6e,00,\
- 65,00,74,00,20,00,45,00,78,00,70,00,6c,00,6f,00,72,00,65,00,72,00,5c,00,69,\
- 00,65,00,78,00,70,00,6c,00,6f,00,72,00,65,00,2e,00,65,00,78,00,65,00,2c,00,\
- 35,00,00,00
- [HKEY_CLASSES_ROOT\Word.RTF.8\shell\ConvertTo\shell\007HTM\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"htm\""
- [HKEY_CLASSES_ROOT\Word.RTF.8\shell\ConvertTo\shell\008HTML]
- "MUIverb"="HTML webpage ()HTML)"
- "Icon"="C:\\Program Files\\Internet Explorer\\iexplore.exe,17"
- [HKEY_CLASSES_ROOT\Word.RTF.8\shell\ConvertTo\shell\008HTML\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"html\""
- [HKEY_CLASSES_ROOT\Word.RTF.8\shell\ConvertTo\shell\009XML]
- "MUIVerb"="XML File (XML)"
- "Icon"="ieframe.dll,2"
- [HKEY_CLASSES_ROOT\Word.RTF.8\shell\ConvertTo\shell\009XML\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"xml\""
- [HKEY_CLASSES_ROOT\Word.RTF.8\shell\ConvertTo\shell\010XPS]
- "MUIVerb"="XPS File (XPS)"
- "Icon"="D:\\Windows\\System32\\xpsrchvw.exe,2"
- [HKEY_CLASSES_ROOT\Word.RTF.8\shell\ConvertTo\shell\010XPS\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"xps\""
- [HKEY_CLASSES_ROOT\MSEdgePDF\shell\ConvertTo]
- "MUIVerb"="Convert To"
- "Position"="Bottom"
- "SubCommands"=""
- [HKEY_CLASSES_ROOT\MSEdgePDF\shell\ConvertTo\shell]
- [HKEY_CLASSES_ROOT\MSEdgePDF\shell\ConvertTo\shell\001DOC]
- "MUIverb"="Word document 1997-2003 (DOC)"
- "Icon"="%ProgramFiles%\\Microsoft Office\\Office15\\WINWORD.exe,-2"
- [HKEY_CLASSES_ROOT\MSEdgePDF\shell\ConvertTo\shell\001DOC\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"doc\""
- [HKEY_CLASSES_ROOT\MSEdgePDF\shell\ConvertTo\shell\002DOCX]
- "MUIVerb"="Word document 2007-2019 (DOCX)"
- "Icon"="%ProgramFiles%\\Microsoft Office\\Office15\\WINWORD.exe"
- [HKEY_CLASSES_ROOT\MSEdgePDF\shell\ConvertTo\shell\002DOCX\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"docx\""
- [HKEY_CLASSES_ROOT\MSEdgePDF\shell\ConvertTo\shell\003PDF]
- "MUIVerb"="Portable Document Format (PDF)"
- "Icon"="C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe,13"
- [HKEY_CLASSES_ROOT\MSEdgePDF\shell\ConvertTo\shell\003PDF\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"pdf\""
- [HKEY_CLASSES_ROOT\MSEdgePDF\shell\ConvertTo\shell\004RTF]
- "MUIVerb"="Rich Text Format (RTF)"
- "Icon"="shell32.dll,1"
- [HKEY_CLASSES_ROOT\MSEdgePDF\shell\ConvertTo\shell\004RTF\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"rtf\""
- [HKEY_CLASSES_ROOT\MSEdgePDF\shell\ConvertTo\shell\005ODT]
- "MUIVerb"="Open Document Text (ODT)"
- "Icon"="C:\\Program Files\\Windows NT\\Accessories\\wordpad.exe,3"
- [HKEY_CLASSES_ROOT\MSEdgePDF\shell\ConvertTo\shell\005ODT\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"odt\""
- [HKEY_CLASSES_ROOT\MSEdgePDF\shell\ConvertTo\shell\006TXT]
- "MUIVerb"="Plain Text File (TXT)"
- "Icon"="shell32.dll,70"
- [HKEY_CLASSES_ROOT\MSEdgePDF\shell\ConvertTo\shell\006TXT\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"txt\""
- [HKEY_CLASSES_ROOT\MSEdgePDF\shell\ConvertTo\shell\007HTM]
- "MUIVerb"="HTML webpage (HTM)"
- "Icon"=hex(2):43,00,3a,00,5c,00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,20,\
- 00,46,00,69,00,6c,00,65,00,73,00,5c,00,49,00,6e,00,74,00,65,00,72,00,6e,00,\
- 65,00,74,00,20,00,45,00,78,00,70,00,6c,00,6f,00,72,00,65,00,72,00,5c,00,69,\
- 00,65,00,78,00,70,00,6c,00,6f,00,72,00,65,00,2e,00,65,00,78,00,65,00,2c,00,\
- 35,00,00,00
- [HKEY_CLASSES_ROOT\MSEdgePDF\shell\ConvertTo\shell\007HTM\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"htm\""
- [HKEY_CLASSES_ROOT\MSEdgePDF\shell\ConvertTo\shell\008HTML]
- "MUIverb"="HTML webpage ()HTML)"
- "Icon"="C:\\Program Files\\Internet Explorer\\iexplore.exe,17"
- [HKEY_CLASSES_ROOT\MSEdgePDF\shell\ConvertTo\shell\008HTML\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"html\""
- [HKEY_CLASSES_ROOT\MSEdgePDF\shell\ConvertTo\shell\009XML]
- "MUIVerb"="XML File (XML)"
- "Icon"="ieframe.dll,2"
- [HKEY_CLASSES_ROOT\MSEdgePDF\shell\ConvertTo\shell\009XML\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"xml\""
- [HKEY_CLASSES_ROOT\MSEdgePDF\shell\ConvertTo\shell\010XPS]
- "MUIVerb"="XPS File (XPS)"
- "Icon"="D:\\Windows\\System32\\xpsrchvw.exe,2"
- [HKEY_CLASSES_ROOT\MSEdgePDF\shell\ConvertTo\shell\010XPS\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"xps\""
- [HKEY_CLASSES_ROOT\MSEdgeHTM\shell\ConvertTo]
- "MUIVerb"="Convert To"
- "Position"="Bottom"
- "SubCommands"=""
- [HKEY_CLASSES_ROOT\MSEdgeHTM\shell\ConvertTo\shell]
- [HKEY_CLASSES_ROOT\MSEdgeHTM\shell\ConvertTo\shell\001DOC]
- "MUIverb"="Word document 1997-2003 (DOC)"
- "Icon"="%ProgramFiles%\\Microsoft Office\\Office15\\WINWORD.exe,-2"
- [HKEY_CLASSES_ROOT\MSEdgeHTM\shell\ConvertTo\shell\001DOC\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"doc\""
- [HKEY_CLASSES_ROOT\MSEdgeHTM\shell\ConvertTo\shell\002DOCX]
- "MUIVerb"="Word document 2007-2019 (DOCX)"
- "Icon"="%ProgramFiles%\\Microsoft Office\\Office15\\WINWORD.exe"
- [HKEY_CLASSES_ROOT\MSEdgeHTM\shell\ConvertTo\shell\002DOCX\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"docx\""
- [HKEY_CLASSES_ROOT\MSEdgeHTM\shell\ConvertTo\shell\003PDF]
- "MUIVerb"="Portable Document Format (PDF)"
- "Icon"="C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe,13"
- [HKEY_CLASSES_ROOT\MSEdgeHTM\shell\ConvertTo\shell\003PDF\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"pdf\""
- [HKEY_CLASSES_ROOT\MSEdgeHTM\shell\ConvertTo\shell\004RTF]
- "MUIVerb"="Rich Text Format (RTF)"
- "Icon"="shell32.dll,1"
- [HKEY_CLASSES_ROOT\MSEdgeHTM\shell\ConvertTo\shell\004RTF\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"rtf\""
- [HKEY_CLASSES_ROOT\MSEdgeHTM\shell\ConvertTo\shell\005ODT]
- "MUIVerb"="Open Document Text (ODT)"
- "Icon"="C:\\Program Files\\Windows NT\\Accessories\\wordpad.exe,3"
- [HKEY_CLASSES_ROOT\MSEdgeHTM\shell\ConvertTo\shell\005ODT\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"odt\""
- [HKEY_CLASSES_ROOT\MSEdgeHTM\shell\ConvertTo\shell\006TXT]
- "MUIVerb"="Plain Text File (TXT)"
- "Icon"="shell32.dll,70"
- [HKEY_CLASSES_ROOT\MSEdgeHTM\shell\ConvertTo\shell\006TXT\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"txt\""
- [HKEY_CLASSES_ROOT\MSEdgeHTM\shell\ConvertTo\shell\007HTM]
- "MUIVerb"="HTML webpage (HTM)"
- "Icon"=hex(2):43,00,3a,00,5c,00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,20,\
- 00,46,00,69,00,6c,00,65,00,73,00,5c,00,49,00,6e,00,74,00,65,00,72,00,6e,00,\
- 65,00,74,00,20,00,45,00,78,00,70,00,6c,00,6f,00,72,00,65,00,72,00,5c,00,69,\
- 00,65,00,78,00,70,00,6c,00,6f,00,72,00,65,00,2e,00,65,00,78,00,65,00,2c,00,\
- 35,00,00,00
- [HKEY_CLASSES_ROOT\MSEdgeHTM\shell\ConvertTo\shell\007HTM\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"htm\""
- [HKEY_CLASSES_ROOT\MSEdgeHTM\shell\ConvertTo\shell\008HTML]
- "MUIverb"="HTML webpage ()HTML)"
- "Icon"="C:\\Program Files\\Internet Explorer\\iexplore.exe,17"
- [HKEY_CLASSES_ROOT\MSEdgeHTM\shell\ConvertTo\shell\008HTML\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"html\""
- [HKEY_CLASSES_ROOT\MSEdgeHTM\shell\ConvertTo\shell\009XML]
- "MUIVerb"="XML File (XML)"
- "Icon"="ieframe.dll,2"
- [HKEY_CLASSES_ROOT\MSEdgeHTM\shell\ConvertTo\shell\009XML\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"xml\""
- [HKEY_CLASSES_ROOT\MSEdgeHTM\shell\ConvertTo\shell\010XPS]
- "MUIVerb"="XPS File (XPS)"
- "Icon"="D:\\Windows\\System32\\xpsrchvw.exe,2"
- [HKEY_CLASSES_ROOT\MSEdgeHTM\shell\ConvertTo\shell\010XPS\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"xps\""
- [HKEY_CLASSES_ROOT\Word.OpenDocumentText.12\shell\ConvertTo]
- "MUIVerb"="Convert To"
- "Position"="Bottom"
- "SubCommands"=""
- [HKEY_CLASSES_ROOT\Word.OpenDocumentText.12\shell\ConvertTo\shell]
- [HKEY_CLASSES_ROOT\Word.OpenDocumentText.12\shell\ConvertTo\shell\001DOC]
- "MUIverb"="Word document 1997-2003 (DOC)"
- "Icon"="%ProgramFiles%\\Microsoft Office\\Office15\\WINWORD.exe,-2"
- [HKEY_CLASSES_ROOT\Word.OpenDocumentText.12\shell\ConvertTo\shell\001DOC\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"doc\""
- [HKEY_CLASSES_ROOT\Word.OpenDocumentText.12\shell\ConvertTo\shell\002DOCX]
- "MUIVerb"="Word document 2007-2019 (DOCX)"
- "Icon"="%ProgramFiles%\\Microsoft Office\\Office15\\WINWORD.exe"
- [HKEY_CLASSES_ROOT\Word.OpenDocumentText.12\shell\ConvertTo\shell\002DOCX\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"docx\""
- [HKEY_CLASSES_ROOT\Word.OpenDocumentText.12\shell\ConvertTo\shell\003PDF]
- "MUIVerb"="Portable Document Format (PDF)"
- "Icon"="C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe,13"
- [HKEY_CLASSES_ROOT\Word.OpenDocumentText.12\shell\ConvertTo\shell\003PDF\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"pdf\""
- [HKEY_CLASSES_ROOT\Word.OpenDocumentText.12\shell\ConvertTo\shell\004RTF]
- "MUIVerb"="Rich Text Format (RTF)"
- "Icon"="shell32.dll,1"
- [HKEY_CLASSES_ROOT\Word.OpenDocumentText.12\shell\ConvertTo\shell\004RTF\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"rtf\""
- [HKEY_CLASSES_ROOT\Word.OpenDocumentText.12\shell\ConvertTo\shell\005ODT]
- "MUIVerb"="Open Document Text (ODT)"
- "Icon"="C:\\Program Files\\Windows NT\\Accessories\\wordpad.exe,3"
- [HKEY_CLASSES_ROOT\Word.OpenDocumentText.12\shell\ConvertTo\shell\005ODT\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"odt\""
- [HKEY_CLASSES_ROOT\Word.OpenDocumentText.12\shell\ConvertTo\shell\006TXT]
- "MUIVerb"="Plain Text File (TXT)"
- "Icon"="shell32.dll,70"
- [HKEY_CLASSES_ROOT\Word.OpenDocumentText.12\shell\ConvertTo\shell\006TXT\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"txt\""
- [HKEY_CLASSES_ROOT\Word.OpenDocumentText.12\shell\ConvertTo\shell\007HTM]
- "MUIVerb"="HTML webpage (HTM)"
- "Icon"=hex(2):43,00,3a,00,5c,00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,20,\
- 00,46,00,69,00,6c,00,65,00,73,00,5c,00,49,00,6e,00,74,00,65,00,72,00,6e,00,\
- 65,00,74,00,20,00,45,00,78,00,70,00,6c,00,6f,00,72,00,65,00,72,00,5c,00,69,\
- 00,65,00,78,00,70,00,6c,00,6f,00,72,00,65,00,2e,00,65,00,78,00,65,00,2c,00,\
- 35,00,00,00
- [HKEY_CLASSES_ROOT\Word.OpenDocumentText.12\shell\ConvertTo\shell\007HTM\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"htm\""
- [HKEY_CLASSES_ROOT\Word.OpenDocumentText.12\shell\ConvertTo\shell\008HTML]
- "MUIverb"="HTML webpage ()HTML)"
- "Icon"="C:\\Program Files\\Internet Explorer\\iexplore.exe,17"
- [HKEY_CLASSES_ROOT\Word.OpenDocumentText.12\shell\ConvertTo\shell\008HTML\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"html\""
- [HKEY_CLASSES_ROOT\Word.OpenDocumentText.12\shell\ConvertTo\shell\009XML]
- "MUIVerb"="XML File (XML)"
- "Icon"="ieframe.dll,2"
- [HKEY_CLASSES_ROOT\Word.OpenDocumentText.12\shell\ConvertTo\shell\009XML\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"xml\""
- [HKEY_CLASSES_ROOT\Word.OpenDocumentText.12\shell\ConvertTo\shell\010XPS]
- "MUIVerb"="XPS File (XPS)"
- "Icon"="D:\\Windows\\System32\\xpsrchvw.exe,2"
- [HKEY_CLASSES_ROOT\Word.OpenDocumentText.12\shell\ConvertTo\shell\010XPS\command]
- @="powershell.exe -file C:\\bin\\Word2Any.ps1 \"%1\" \"xps\""
- '@ | Set-Content C:\bin\wordsav.reg
- regedit.exe /s C:\bin\wordsav.reg
- }
- function Uninstall {
- @'
- Windows Registry Editor Version 5.00
- [-HKEY_CLASSES_ROOT\Word.Document.12\shell\ConvertTo]
- [-HKEY_CLASSES_ROOT\Word.Document.8\shell\ConvertTo]
- [-HKEY_CLASSES_ROOT\Word.RTF.8\shell\ConvertTo]
- [-HKEY_CLASSES_ROOT\Word.OpenDocumentText.12\shell\ConvertTo]
- [-HKEY_CLASSES_ROOT\MSEdgePDF\shell\ConvertTo]
- [-HKEY_CLASSES_ROOT\MSEdgeHTM\shell\ConvertTo]
- '@ | Set-Content uninstall.reg
- regedit /s uninstall.reg
- Remove-Item C:\bin\Word2Any.ps1
- Remove-Item C:\bin\wordsav.reg
- Remove-Item C:\bin
- }
- [Console]::WindowWidth = 192
- [Console]::Title = "Word2AnyInstall"
- @'
- ################################################################################################################################################################
- Word2AnyInstall.ps1
- This script will install context menus on .DOC,.DOCX,.RTF,.PDF,.HTM,.HTML,.ODT,.XML,.XPS files to convert them to different format using MS Word
- Right-click any file in these extensions and you will get a menu abiove "Properties" use it
- An MSI-based (not Click-To-Run) installation of MS Office is required, will work for Office 2007+ versions and even Unactivated versions will work too
- While conversion, just make sure that MS Word is not Open and please don't occupy C:\bin directory where files will be kept
- ################################################################################################################################################################
- '@
- $msg = @'
- [1] Install
- [2] Repair
- [3] Uninstall
- '@
- choice /c 123 /n /m $msg
- switch ($LastExitCode) {
- 1 {Install}
- 2 {Install}
- 3 {Uninstall}
- }
- Write-Host "`nDone!"
- Read-Host
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement