powershell 安装-Excel的加载项
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了powershell 安装-Excel的加载项相关的知识,希望对你有一定的参考价值。
## Path to the Excel addin
$ExceAddin = '/R "F:\Applic\NtRand_Excel_Addin\NtRand330_x86.xll'
## Registry key to check
$regPath = 'HKCU:\\Software\Microsoft\Office\14.0\Excel\Options'
$regKeyExists = $false
Function Test-RegistryValue {
param
(
[Object]
$RegKey,
[Object]
$RegName
)
Get-ItemProperty $RegKey $RegName -ErrorAction SilentlyContinue | Out-Null
$?
}
$regName = 'OPEN'
if (Test-RegistryValue -Regkey $regPath -RegName $regName) {
$regValue = (Get-ItemProperty -Path $regPath).$regName
if ($regValue -match 'NtRand_Excel_Addin') {
$regKeyExists = $true
}
}
else {
## OPEN key does not exist.
## Create the OPEN key and set the value to the Excel addin
Set-ItemProperty -Path $regPath -Name $regName -Value $ExceAddin
$regKeyExists = $true
}
$openCounter = 1
while ($regKeyExists -eq $false)
{
$regName = "OPEN$openCounter"
if (Test-RegistryValue -Regkey $regPath -RegName $regName) {
$regValue = (Get-ItemProperty -Path $regPath).$regName
if ($regValue -match 'NtRand_Excel_Addin') {
$regKeyExists = $true
}
}
else {
## OPENx key does not exist.
## Create the OPENx key and set the value to the Excel addin
Set-ItemProperty -Path $regPath -Name $regName -Value $ExceAddin
$regKeyExists = $true
}
## The next OPENx value
$openCounter++
}
以上是关于powershell 安装-Excel的加载项的主要内容,如果未能解决你的问题,请参考以下文章
Excel 2007 VSTO 加载项即使在成功安装后也不可见
如何用2007WPS excel 进行数据分析?如何安装啥加载项,
Excel Batch Translation
预警系统 | Powershell:加载日历项扩展属性
为啥打开EXcel表格时,总会出现正在安装microsoft excel功能
EXCEL启动慢