Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Issuing a windows command from the powershell command line

$
0
0

Hello,

I want to issue a command from powershell script after getting input in a form. I looked on line and

saw that the command should look like :

@powershell -Command "powercfg -Change -monitor-timeout-ac $TextBox1.Text"

but that gives me an error of

At line:1 char:13
+ @powershell -Command "powercfg -Change -monitor-timeout-ac $TextBox1.Text"
+             ~~~~~~~~
Unexpected token '-Command' in expression or statement.
At line:1 char:22
+ @powershell -Command "powercfg -Change -monitor-timeout-ac $TextBox1.Text"

Any suggestions on what I am doing wrong?


Viewing all articles
Browse latest Browse all 6937

Trending Articles