Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Powershell run message box from cmd

I am trying to achieve the following :

I need to run from batch file psh script , but not from file , solo de command line. I've tried the following code from ps console and it works , but when passing this from cmd - not.

powershell.exe -ExecutionPolicy Bypass -Command {[System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms'); [System.Windows.Forms.MessageBox]::Show('We are proceeding with next step.')}

Can anyone pls help to figure out la problema ? Gracias.

like image 368
Wpftutorials Wpf Avatar asked Mar 03 '26 11:03

Wpftutorials Wpf


1 Answers

Switch {brackets} for "quotes":

@powershell.exe -ExecutionPolicy Bypass -Command "[System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms'); [System.Windows.Forms.MessageBox]::Show('We are proceeding with next step.')"

(also added the @ for echo off)

like image 140
JohnLBevan Avatar answered Mar 05 '26 12:03

JohnLBevan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!