On Tue, Dec 3, 2013 at 10:34 AM, Chip Davis <[email protected]> wrote:

> I may be out in left field here, but I think Leslie is asking about
> creating a Windows shortcut that invokes the Powershell instead of the
> Command Prompt shell.
>
> I'm interested in the answer as well.
>

Chip,

Maybe ...

To create a short cut is relatively easy.  You want the short cut to be to
the PowerShell executable.

On my Vista system, this is:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

One of the simpler ways to create a short cut is to go to that folder in
Windows Explorer, right click on powershell.exe and choose Send To Desktop.

That puts the short cut on the desktop, where you can edit it to your
preferences.  For instance, as is, it will open the PowerShell window with
the current directory C:\Windows\System32\WindowsPowerShell\v1.0.  I'd
change that to C:\work.ooRexx of course.

You could pin the short cut to the Start Menu, etc..

I see one  thing that doesn't work as I expected.  Take this quick test:

say "Hello World!"
'Get-Process | Out-File test.txt'

The second line is a valid PowerShell command that writes the output from
the Get-Process cmdlet to the file test.txt.

PS C:\work.ooRexx\wc\ooDialog\trunk\examples> .\quick.rex
Hello World!
'Get-Process' is not recognized as an internal or external command,
operable program or batch file.
PS C:\work.ooRexx\wc\ooDialog\trunk\examples>

The error message is straight from cmd.exe, so I tried this:

say "Hello World!"
address 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe'
'Get-Process | Out-File test.txt'

PS C:\work.ooRexx\wc\ooDialog\trunk\examples> .\quick.rex
Hello World!
     4 *-* 'Get-Process | Out-File test.txt'
       >>>   "Get-Process | Out-File test.txt"
       +++   "RC(30)"
PS C:\work.ooRexx\wc\ooDialog\trunk\examples>

PS C:\work.ooRexx\wc\ooDialog\trunk\examples> net helpmsg 30

The system cannot read from the specified device.

PS C:\work.ooRexx\wc\ooDialog\trunk\examples>

So, I'm not sure if the address command worked and the 30 was returned from
PowerShell, or ...

It might be that we would need to write a specific command handler for
PowerShell.  I'm a little hazy on the details concerning command handlers.

I was hoping that the string: 'Get-Process | Out-File test.txt' would just
get passed the PowerShell environment and it would magically work.  ;-)

The PowerShell command itself is good:

PS C:\work.ooRexx\wc\ooDialog\trunk\examples> Get-Process | Out-File
test.txt
PS C:\work.ooRexx\wc\ooDialog\trunk\examples> cat .\test.txt

Handles  NPM(K)    PM(K)      WS(K) VM(M)   CPU(s)     Id ProcessName
-------  ------    -----      ----- -----   ------     -- -----------
     71       8     1160       3336    42     0.02   1508 armsvc
    175      24    64092      50020   237     3.14    992 chrome
...

--
Mark Miesfeld
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
_______________________________________________
Oorexx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-users

Reply via email to