Run dialog run powershell command

Is there a way to run a powershell command when opening a run window (Windows + R)?

I would like to just start typing get-process, for example, and execute this command in powershell and display the result (basically opening it and not closing it).

I know that you can type "powershell / noexit get-process" to achieve this, but I would like to know if there is a way that Run starts the powershell command and all I need to type is the command: get -process ...

+3


source to share


1 answer


No , it is not possible to install Windows+ Commands Rdirectly from PowerShell Commands.

One way to solve this problem is to create a batch file with content like this:

@echo off
%systemroot%\System32\WindowsPowerShell\v1.0\powershell.exe -noexit -noprofile -noLogo "%1 %2 %3 %4 %5 %6 %7 %8"

      

name it p.cmd

and place it in a place that is in your path.



Now you can do:

Run example

start with p

, then run the PowerShell command you want to execute.

+4


source







All Articles