我有如下test.txt文件,就像所有ip一样。(示例:)
192.168.xxx.50
192.168.xxx.51
192.168.xxx.52
192.168.xxx.53
192.168.xxx.54
192.168.xxx.55
我想通过那些IP 使用psexec、wmic制作批处理文件
FOR /F "tokens=* delims=," %%i in (test.txt) do (
psexec \<i dont know how to do in here..it should be ip in here each line>-u <domain>administrator -p <password> wmic /output:\<serverip should be here which is going to save>d$%(i want this each ip info)%.txt product get name,vendor
)
怎么做。。?我想我不知道%%参数
Wmic可以在没有PSExec帮助的情况下完成此操作。您的文件的格式对于wmic来说是正确的。
wmic /node:@"Computerlist.txt" product get name,vendor /format:htable
参见wmic /node /?
和wmic /format /?
。
开始-所有程序-附件-右键单击命令提示符并选择"以管理员身份运行"。键入(或右键复制粘贴在"命令提示"窗口中,然后选择"粘贴")。表格格式的类型
wmic /output:"%userprofile%desktopWindowsInstaller.html" product get /format:htable
或者以形式格式
wmic /output:"%userprofile%desktopWindowsInstaller.html" product get /format:hform
它将在桌面上创建一个html文件。
注意
这不是一个完整的列表。这只是使用Windows Installer安装的产品。没有任何功能。
然而,正如我在上一篇文章中所说,几乎所有的东西都列在注册表中。
所以在命令提示符中看到它
reg query HKLMSOFTWAREMicrosoftWindowsCurrentVersionUninstall /s
或在文件中
reg query HKLMSOFTWAREMicrosoftWindowsCurrentVersionUninstall /s>"%userprofile%desktopWindowsUninstall.txt"
以不同格式的在记事本中查看
单击开始-所有程序-附件-右键单击命令提示符,然后选择以管理员身份运行。键入Regedit并导航到
HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionUninstall
右键单击"卸载"键,然后选择"导出"。如果您保存为reg文件(还有文本文件,它们的文本格式略有不同),您需要右键单击该文件并选择"编辑"来查看它。
查看Windows更新
wmic /output:"%userprofile%desktopWindowsUpdate.html" qfe get /format:htable