![]() |
|
30 Oct 2019 | #1 |
|
How to execute Powershell command from CommandPrompt? One line!
I want to execute a PowerShell command from Command Prompt.
This should be done by entering ONE command! I DO NOT want to start PowerShell first and then enter the PowerShell command. Instead I want to enter something like powershell.exe -command "......." How does that work in detail on Win7? Peter |
My System Specs![]() |
. |
|
30 Oct 2019 | #2 |
|
Hi pstein,
I want to execute a PowerShell command from Command Prompt.
This should be done by entering ONE command! I DO NOT want to start PowerShell first and then enter the PowerShell command. Instead I want to enter something like powershell.exe -command "......." How does that work in detail on Win7? |
My System Specs![]() |
30 Oct 2019 | #3 |
|
Hi pstein,
If you wanted to get the bit-type of your OS for example, you could use this in the cmd prompt . . . Code:
Powershell -Command (Get-WmiObject Win32_OperatingSystem).OSArchitecture I hope this helps! |
My System Specs![]() |
. |
|
31 Oct 2019 | #4 |
|
Why does
Powershell -Command {Get-HotFix | Sort InstalledOn -Desc} NOT work? When I enter this in CmdPrompt/Batch script then the output is: "Input file specified two times." |
My System Specs![]() |
31 Oct 2019 | #5 |
|
Hi pstein, I do have a batch script that lists all the installed updates!
|
My System Specs![]() |
31 Oct 2019 | #6 |
|
You need to create a string that Powershell can execute, so in your case, type: Powershell -Command "& {Get-HotFix | Sort InstalledOn -Desc}" Obvious when you know how!! |
My System Specs![]() |
31 Oct 2019 | #7 |
|
|
My System Specs![]() |
. |
31 Oct 2019 | #8 |
|
|
My System Specs![]() |
31 Oct 2019 | #9 |
|
|
My System Specs![]() |
![]() |
Thread Tools | |
Similar help and support threads | ||||
Thread | Forum | |||
vbs how to execute a command with quoted parameters Hi, OS: Win7 64bits Family Can't find the way to fix quoting issue. Suppose in the command prompt this works: "c:\what ever\my program.exe" "d:\some dir\my file.txt" cat 1-2 output "d\some dir\_out.txt" |
General Discussion | |||
execute command at boot Hi, I would like to execute a command at boot and repeat it until it succeeds. Does anyone know how I can achieve that ? For the moment, I run the command in the startup folder, so it does run just after user connection but, as it is a connection demand to another computer by ssh, if the... |
General Discussion | |||
Start Command Prompt and automatically execute a few commands I am learning a programming language, and I frequently use command prompt to compile source codes, but every time I start command prompt I need to manually cd to the correct directory, and then I like to run cls to keep the window clean. I have looked around, but I'm not sure how to phrase a google... |
Software | |||
Execute Last Command scenario : 1. lmb to select a file or folder. 2. rmb to display context menu and choose 'rename'. 3. type new name. 4. lmb to select another file or folder 5. ... is there a way to program a key or a mouse button to automatically execute step 2 above? Or perhaps it's already one of my... |
General Discussion |
Our Sites |
Site Links |
About Us |
Find Us |
Windows 7 Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows 7" and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd All times are GMT -5. The time now is 03:26. |
![]() ![]() |