0
votes

I want to start a powershell window with a title and execute a command at the same time. My line of code starts a powershell window with a title but does not execute the command in powershell (execute is in the cmd-window).

How can I fix the problem to get the execution in the powershell window I created with the title?

Thanks for helping me out

    start powershell -command "$Host.UI.RawUI.WindowTitle = 'WebWolf'" & java -jar .\webwolf-8.0.0.M25.jar --server.port=8090
1
Your powershell command is enclosed within doublequotes, but you haven't included your java execution command within them! - Compo
If you want to execute java inside of powershell window then add its command line inside of the -command parameter. BTW if you just need a window with a title start is enough. - montonero
Is it important that webwolf.exe runs in a PowerShell host? If not, start "WebWolf" java -jar .\webwolf-8.0.0.M25.jar --server.port=8090 would run it in a cmd.exe shell with the title you desire. - lit
start powershell -noExit -command "$Host.UI.RawUI.WindowTitle ='WebWolf' & java -jar .\webgoat-server-8.0.0.M25.jar --server.port=8090" is not working either now I get a error message: & is not a valid token - Maxi

1 Answers

0
votes

The following syntax should work for you. Just swap out the -Command text with your java commands.

start "WebWolf" powershell.exe -NoExit -Command "reg.exe /?"

Example of working code