如何设置 Word 2010,以便另存为 PDF 是一个 1 个按钮(或按键)选项,而不是默认的 4 步File > Save & Send > Create PDF/XPS Document > Create PDF/XPS
工作流程?
答案1
我已经在家用电脑(使用 Word 2007)的功能区中添加了“PDF 或 XPS”命令,并且我在办公室电脑(使用 Word 2010;虽然我不记得那里的命令是否命名为相同)上也做了同样的事情。
现在,我的功能区上有一个额外的按钮,在工具提示中显示“PDF 或 XPS”,当我将鼠标悬停在它上面并单击它时,它会打开一个另存为对话框,我可以在其中指定 PDF 文件的文件名,该文件将根据我当前打开的 DOCX(或其他)文档在下一步中创建。
您可以从更多命令。 这 ”以 PDF 或 XPS 格式发布“命令是文件选项卡。
答案2
你需要做两件事。
- 创建宏来执行您想要的操作
- 指定一个按钮来调用宏
这是宏
Sub SaveAsPDF()
With Dialogs(wdDialogFileSaveAs)
.Format = wdFormatPDF
.Show
End With
End Sub
将其粘贴到Normal > NewMacros
VBA Explorer ( Alt+ F11) 的模块中。
现在选择快速访问工具栏的下拉箭头并选择More Commands...
。现在Macros
从中选择Choose commands from
,选择宏,然后将其添加到右侧窗格。您可以使用Modify Button
底部的修改名称和图标。
现在您有一个按钮,它将打开文件保存对话框(以便您可以命名它),并将其安全保存为 PDF。
答案3
此外,完成此操作后(添加到快捷菜单),如果按下ALT它,应该会显示命令的编号。然后您可以按ALT+Number并使用键盘快捷键。我按照 Westcoast 的建议操作,然后当我按下ALT它时,它显示为数字 4,因此我按ALT+4并将其保存为 PDF。太棒了!
答案4
我为此编写了一个 powershell 脚本。运行它并单击安装。然后右键单击任何 PDF 文件并转到转换为(底部)并单击 XPS 按钮。无需打开 Microsoft Word,转换后的文件将保存在当前目录中。
# 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