You are not logged in.

#1 09 Jun 2016 12:51

reprovo
New Member
Registered: 09 Jun 2016
Posts: 3

Cannot pipe cmd command to powershell when using "start"

Hi.

I'm running the following command In a Java app.

cmd /k type zerozero.ps1 | powershell.exe -noprofile -

the file runs and Is piped to powershell as expected but the cmd windows does not appear to show details I want the user to see.

I've tried running :

cmd /C start cmd /k type zerozero.ps1 | powershell.exe -noprofile -

the cmd window opens using this command but only the type command runs and displays the output.
Piping to PowerShell doesn't work when I use "start"

Is there some Issue with using start I am unaware of ?

Would appreciate any assistance.

Thanks In advance.

Offline

#2 09 Jun 2016 13:18

bluesxman
Member
From: UK
Registered: 29 Dec 2006
Posts: 1,129

Re: Cannot pipe cmd command to powershell when using "start"

Why are you piping to powershell?  Seems like an odd way to go about things.

How about this?

cmd /c start "" cmd /k powershell.exe -noprofile zerozero.ps1

cmd | *sh | ruby | chef

Offline

#3 09 Jun 2016 13:45

reprovo
New Member
Registered: 09 Jun 2016
Posts: 3

Re: Cannot pipe cmd command to powershell when using "start"

Hi.

I want to run the app on any pc without needing to change access rights for running powershell scripts. I pipe the command to bypass this.

Offline

#4 09 Jun 2016 13:47

reprovo
New Member
Registered: 09 Jun 2016
Posts: 3

Re: Cannot pipe cmd command to powershell when using "start"

If the method you provided works without needing to make any access changes to powershell , I'll use that. Don't have time to check at the moment.

Offline

Board footer

Powered by