我正在处理一个打开其他程序的个人项目,目前我正在使用一个文本文件,在这里我必须手动输入exe文件的路径,如下所示
C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe 我想知道有什么方法可以得到所有exe文件的位置列表吗?我知道如何获得已安装程序的列表,以及使用
Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* 但它并没有给出整个道路。
发布于 2019-02-17 02:15:30
程序员使用Internet,这是Windows上的一个关键编程组件。所以使用非windows程序是很愚蠢的。
Start chrome在HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths上列出的程序可以通过键入它们的名称在Windows中启动。在控制台中,可以使用start强制通过shell执行。
注:调用所有文件something.exe,但实际文件不需要是一个exe。
所以
Win.exe
@="C:\Windows\win.ini键入win时,它将打开win.ini。
路径
将公共控制台程序添加到path允许您只键入名称。
从我的PasteBin帐户https://pastebin.com/YKEmChkc这个文件
此批处理文件将批处理文件所在的文件夹添加到用户的路径中,以供以后使用命令提示。
REM One file follows
REM _AddThisFolderToPath.bat
REM This batch file adds the folder the batch file is in to the user's path for future command prompts
REM If the folder is already in the user's path the command is ignored
Setx path "%path%;%~dp0"
REM Optional add to the current path setting
REM Set path "%path%;%~dp0"
Pause在命令提示符中键入path /?、set /?、setx /?、ftype /?、assoc /?。
还请参阅CreateProcess使用的默认搜索。
1.从其中加载应用程序的目录。 2.父进程的当前目录。 3.32位Windows系统目录.使用GetSystemDirectory函数获取此目录的路径。
5. Windows目录。使用GetWindowsDirectory函数获取此目录的路径。
6. PATH环境变量中列出的目录。请注意,此函数不搜索应用程序路径注册表项指定的每个应用程序路径。若要在搜索序列中包含此每个应用程序路径,请使用ShellExecute函数。
启动-所有程序-附件-右键单击命令提示符,并选择运行作为管理员。键入(或通过右键单击命令提示符窗口并选择“粘贴”来复制和粘贴)。表格格式类型
wmic /output:"%userprofile%\desktop\WindowsInstaller.html" product get /format:htable或以表格形式
wmic /output:"%userprofile%\desktop\WindowsInstaller.html" product get /format:hform它将在桌面上创建一个html文件。
备注
这不是一个完整的名单。这是只安装Windows安装程序的产品。一切都没有特色。
然而,正如我在上一篇文章中所说,几乎所有的东西都在注册表中列出。
因此,要在命令提示符中查看它
reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall /s或者在文件里
reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall /s>"%userprofile%\desktop\WindowsUninstall.txt"以不同格式在记事本中查看
单击“启动-所有程序-附件”-右键单击命令提示符,然后选择“以管理员身份运行”。键入Regedit并导航到
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall右键单击“卸载”键并选择“导出”。如果您保存为reg文件(也有文本文件,它们是略有不同的文本格式),则需要右键单击该文件并选择Edit查看它。
查看Windows更新
wmic /output:"%userprofile%\desktop\WindowsUpdate.html" qfe get /format:htable。
发布于 2019-02-17 11:16:44
这段代码是为powershell编写的,但是这个想法也适用于其他编程lingos。它读取local machine/all users & current user reg键的32/64位卸载键。
function Get-LD_InstalledSoftware
<#
.SYNOPSIS
Get Installed software via the registry.
.NOTES
Original source ...
Find Installed Software - Power Tips - PowerTips - IDERA Community
- http://community.idera.com/powershell/powertips/b/tips/posts/find-installed-software
Version
- 2017.09.22.23.35.49
== added Publisher search item
- 2018.09.21.10.04.24
== changed name to avoid collision with other similar code
#>
{
[CmdletBinding()]
Param
(
# Wildcard characters allowed - and recommended.
[Parameter()]
[string]
$DisplayName = '*',
# Wildcard characters allowed.
[Parameter()]
[string]
$DisplayVersion = '*',
# Use 'yyyyMMdd' format.
[Parameter()]
[string]
$InstallDate = '*',
# Wildcard characters allowed.
[Parameter()]
[string]
$Publisher = '*',
# Wildcard characters allowed, but normally this otta be left to the default.
[Parameter()]
[string]
$UninstallString = '*'
)
# registry locations for installed software
$Provider = 'Registry::'
$All = 'HKEY_LOCAL_MACHINE\SOFTWARE'
$Current = 'HKEY_CURRENT_USER\SOFTWARE'
$64_32 = 'Microsoft\Windows\CurrentVersion\Uninstall\*'
$32_on_64 = 'WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*'
$RPathAllUser = -join ($Provider, (Join-Path -Path $All -ChildPath $64_32))
$RPathCurrentUser = -join ($Provider, (Join-Path -Path $Current -ChildPath $64_32))
$RPathAllUser32 = -join ($Provider, (Join-Path -Path $All -ChildPath $32_on_64))
$RPathCurrentUser32 = -join ($Provider, (Join-Path -Path $Current -ChildPath $32_on_64))
# get all values from all 4 registry locations
$Result = Get-ItemProperty -Path $RPathAllUser, $RPathCurrentUser, $RPathAllUser32, $RPathCurrentUser32 |
# skip items without a DisplayName
Where-Object DisplayName -ne $null |
Where-Object {
$_.DisplayName -like $DisplayName -and
$_.DisplayVersion -like $DisplayVersion -and
$_.InstallDate -like $InstallDate -and
$_.Publisher -like $Publisher -and
$_.UninstallString -like $UninstallString
} |
Sort-Object -Property DisplayName
$Result
}这么叫..。
Get-LD_InstalledSoftware -DisplayName *chrome*..。你会得到以下信息..。
DisplayName : Google Chrome
UninstallString : "C:\Program Files (x86)\Google\Chrome\Application\72.0.3626.109\Installer\setup.exe" --uninstall --system-level --verbose-logging
InstallLocation : C:\Program Files (x86)\Google\Chrome\Application
DisplayIcon : C:\Program Files (x86)\Google\Chrome\Application\chrome.exe,0
NoModify : 1
NoRepair : 1
Publisher : Google Inc.
Version : 72.0.3626.109
DisplayVersion : 72.0.3626.109
InstallDate : 20190213
VersionMajor : 3626
VersionMinor : 109
PSPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Google Chrome
PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall
PSChildName : Google Chrome
PSProvider : Microsoft.PowerShell.Core\Registry可以很容易地对输出进行过滤,使其只包含所需的详细信息。
https://stackoverflow.com/questions/54729443
复制相似问题