Running a small WMI Powershell Script -


i'm trying have few scripts can map run keyboard changing monitor/screen brightness. after searching on internet, found script works when enter powershell.

$monitor=@(gwmi wmimonitorbrightnessmethods -ns root/wmi)[0] $monitor.wmisetbrightness(50,0)

after saved .ps1 file , tried running file, powershell tells me: term "path of file" not recognized name of cmdlet, function... , on.

i'm not familiar powershell @ all, can need add in order script run properly?

by default can't run powershell script in current directory without putting .\ in front of script name, or calling full path of script.

this security feature.

if in directory contains script, run executing in powershell window:

.\yourscript.ps1 

where yourscript name of script.

see here more information: https://ss64.com/ps/syntax-run.html

you may see error if script has spaces in name. if case, enclose path in quotes:

.\'your script.ps1' 

Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -