1
0 Comments

Lately, I have been utilizing Blender, but it appears that certain mistakes are solely displayed in the console. When I start Blender manually through PowerShell, it operates correctly and I am able to access the error messages. Nonetheless, I want to modify my shortcut to execute this task for me.

In essence, my objective is to launch any command in PowerShell through a shortcut. I have attempted entering these commands in the “Target” section, but with no favorable outcome:

powershell "C:\Program Files\Blender Foundation\Blender\blender.exe"
powershell Invoke-Expression "C:\Program Files\Blender Foundation\Blender\blender.exe"
Invoke-Expression "C:\Program Files\Blender Foundation\Blender\blender.exe"

The initial two actions result in the brief display of a black command window that disappears immediately, and when I click “Apply”, Powershell is substituted with C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe. I’ve decided to include the shortened version here.

As for the third action, it generates an error message that states “The name ‘Invoke-Expression’ specified in the Target box is not valid.”

Therefore, I attempted to add “-NoExit -Command:” to the command:

powershell -NoExit -Command "C:\Program Files\Blender Foundation\Blender\blender.exe"

A window emerges containing the statement “C:\Program: The term ‘C:\Program’ is not recognized as the name of a cmdlet, function, script file, or operable program.” It’s odd that it becomes stuck at the space despite enclosing the path in quotes. I also attempted to use a pair of single quotes, but the issue persisted:

powershell -NoExit -Command '"C:\Program Files\Blender Foundation\Blender\blender.exe"'
powershell -NoExit -Command "'C:\Program Files\Blender Foundation\Blender\blender.exe'"

Instead of executing the desired command, this only produces a PowerShell window that launches to a command prompt and prints out the command:

C:\Program Files\Blender Foundation\Blender\blender.exe
PS C:\Program Files\Blender Foundation\Blender>

What is the method for executing a command or program in PowerShell using a shortcut?

Askify Moderator Edited question April 28, 2023