检查 GPU PowerShell
Check GPU PowerShell
我的 PowerShell 脚本优化显卡
所以当我调用 GPU Tweaker 时它给出了这个错误
术语“GpuTweaker”未被识别为 cmdlet 函数脚本文件或可运行程序的名称
有人可以编辑我的代码吗?
$GPU = (Get-WmiObject Win32_VideoController).Name
Function GPUTweaker{
If ($GPU -like "*NVIDIA*") {
<FunctionName>
}
If ($GPU -like "*AMD*") {
<FunctionName>
}
If ($GPU -like "*Intel*") {
<FunctionName>
}
}
对于 -like
运算符你应该使用通配符,否则它不会 return 想要的结果。
在我的例子中:
C:\> $gpu = (Get-WmiObject Win32_VideoController).Name
C:\> $gpu
Intel(R) UHD Graphics 620
C:\> $gpu -like "Intel"
False
C:\> $gpu -like "*Intel*"
True
C:\> $gpu -like "Intel*"
True
有关更多示例,请参阅 about_Comparison_Operators。
我的 PowerShell 脚本优化显卡 所以当我调用 GPU Tweaker 时它给出了这个错误 术语“GpuTweaker”未被识别为 cmdlet 函数脚本文件或可运行程序的名称 有人可以编辑我的代码吗?
$GPU = (Get-WmiObject Win32_VideoController).Name
Function GPUTweaker{
If ($GPU -like "*NVIDIA*") {
<FunctionName>
}
If ($GPU -like "*AMD*") {
<FunctionName>
}
If ($GPU -like "*Intel*") {
<FunctionName>
}
}
对于 -like
运算符你应该使用通配符,否则它不会 return 想要的结果。
在我的例子中:
C:\> $gpu = (Get-WmiObject Win32_VideoController).Name
C:\> $gpu
Intel(R) UHD Graphics 620
C:\> $gpu -like "Intel"
False
C:\> $gpu -like "*Intel*"
True
C:\> $gpu -like "Intel*"
True
有关更多示例,请参阅 about_Comparison_Operators。