dxdiag /t output.txt
FOR %%GeForce IN output.txt DO echo You have an NVIDIA GPU.
FOR %%Radeon IN output.txt DO echo You have an AMD GPU.
以上是我创建的批处理文件的片段。当我运行它时,会出现以下错误消息:
%GeForce was unexpected at this time.
批处理文件退出。我已经尝试了其他答案,但似乎没有任何帮助。我的语法有什么问题吗?我在Dell Latitude E6400上运行Windows XP SP3。
答案 0 :(得分:1)
这不是FOR的有效语法 你想要的是
find "GeForce" output2.txt >nul && echo You have an NVIDIA GPU.
find "Radeon" output2.txt >nul && echo You have an AMD GPU.
答案 1 :(得分:-1)
Herro,如果你想尝试使用“for”命令试试这个
dxdiag /t output.txt
FOR /f %%a IN (output.txt) DO (
if %%a == GeForce echo You have an NVIDIA GPU.)
FOR /f %%a IN (output.txt) DO (
if %%a == Radeon echo You have an AMD GPU.)
这会查看文本文件中的每一行,如果找到包含“Geforce”或“Radeon”的行,它将回显以下消息。
*请注意,它仅适用于整行文字。
你的,莫娜