Windows 远程获取已安装程序列表时未找到实例

Windows 远程获取已安装程序列表时未找到实例,windows,command-prompt,wmic,working-remotely,Windows,Command Prompt,Wmic,Working Remotely,因此,每次我运行批处理文件时,我都会键入计算机名称,然后键入我要查找的程序。我添加了“name like”(word)%”部分,因此不需要精确匹配即可找到程序。这是我的密码: @echo off set /p name="Enter PC Name: " set /p prgm="Type Part of the Program Name: " wmic /node:%name% product where "name like '%prgm%%'" get name,version set /

因此,每次我运行批处理文件时,我都会键入计算机名称,然后键入我要查找的程序。我添加了“name like”(word)%”部分,因此不需要精确匹配即可找到程序。这是我的密码:

@echo off
set /p name="Enter PC Name: "
set /p prgm="Type Part of the Program Name: "
wmic /node:%name% product where "name like '%prgm%%'" get name,version
set /p fprgm="Enter Full Program Name: "
wmic /node:%name% product where name="%fprgm%" call uninstall
pause
我不确定发生了什么,因为如果我手动进入WMIC,并使用
/node:(pc名称)产品进行搜索,其中“类似名称”(word)%”获取名称,版本
,它可以工作。

您需要按字面意思进行处理

要将百分号(
%%
)视为批处理脚本中的常规字符,请将其加倍(
%%
),如下例所示:

==>type 29951224.bat
@ECHO ON >NUL
@SETLOCAL

set "name=localhost"
set "prgm=visual F"
wmic /node:%name% product where "name like '%prgm%%%'" get name,version

==>29951224.bat

==>set "name=localhost"
==>set "prgm=visual F"
==>wmic /node:localhost product where "name like 'visual F%'" get name,version
Name               Version
Visual F# 3.1 SDK  12.0.21005
Visual F# 3.1 VS   12.0.21005

==>