Fwd: Re: NetRexx .Net - related

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Fwd: Re: NetRexx .Net - related

rvjansen
I understand that my description of the problem is clear as mud, so let
me try to explain this. In Unix, an environment variable needs to be
explicitly exported to be used in a child process. This is done using
export (bash, ksh, etc) or setenv (tcsh, csh, etc).

In DOS bat and consequently the NT Shell, set will do it, and for the
rest of the session in that window, the values will keep.

In Powershell, however, we are more in unix-territory. When I run the
old style batchfile, subsequent runs of the nrc command do not find the
new values. It needs something more. Now when I do:


G:\>type envset.ps1
# set path for binaries
$env:path = "%path%;g:\bin;C:\Program
Files\IBM\WebSphere\AST\runtimes\base_v61_stub\java\bin"
$env:classpath = ".;g:\lib\NetRexxC.jar;g:\lib\tools.jar"

and run it with ./envset

I get a fairly unsympathetic message:

PS G:\> ./envset
File G:\envset.ps1 cannot be loaded because the execution of scripts is
disabled on this system. Please see "get-help about_signing" for more
details.
At line:1 char:9
+ ./envset <<<<
     + CategoryInfo          : NotSpecified: (:) [], PSSecurityException
     + FullyQualifiedErrorId : RuntimeException

but would this work on ordinary home systems?

best regards,

René.


-------- Original Message --------
Subject: Re: [Ibm-netrexx] NetRexx  .Net - related
Date: 2012-06-29 15:43
 From: rvjansen <[hidden email]>
To: IBM Netrexx <[hidden email]>
Reply-To: IBM Netrexx <[hidden email]>

On 2012-06-29 15:28, Measel, Mike wrote:

> René, from my XP system with powershell:
>
> PS Z:\> get-childitem env: | sort name
>
> Name                           Value
> ----                           -----
> ALLUSERSPROFILE                C:\Documents and Settings\All Users
> APPDATA                        C:\Documents and
> Settings\Owner\Application Data
> CLASSPATH
> c:\Netrexx\lib\NetRexxC.jar;c:\usr\java\tools.jar
> CLIENTNAME                     Console
> CommonProgramFiles             C:\Program Files\Common Files
> COMPUTERNAME                   VIRTUALVIAO
> ComSpec                        C:\WINDOWS\system32\cmd.exe
> FP_NO_HOST_CHECK               NO
> HOMEDRIVE                      C:
> HOMEPATH                       \Documents and Settings\Owner
> JAVA_HOME                      c:\program files\jdk\jdk1.5.0_22
> LM_LICENSE_FILE                C:\Program Files\HyPerformix\License;
> LOGONSERVER                    \\VIRTUALVIAO
> NUMBER_OF_PROCESSORS           4
> OS                             Windows_NT
> Path                           c:\program
>
> files\java\jdk1.5.0_22\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\Syste...
> PATHEXT
> .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.PSC1
> PROCESSOR_ARCHITECTURE         x86
> PROCESSOR_IDENTIFIER           x86 Family 6 Model 30 Stepping 5,
> GenuineIntel
> PROCESSOR_LEVEL                6
> PROCESSOR_REVISION             1e05
> ProgramFiles                   C:\Program Files
> PSModulePath                   C:\Documents and Settings\Owner\My
> Documents\WindowsPowerShell\Modules;C:\WINDOWS\sys...
> SESSIONNAME                    Console
> SystemDrive                    C:
> SystemRoot                     C:\WINDOWS
> TEMP                           C:\DOCUME~1\Owner\LOCALS~1\Temp
> TMP                            C:\DOCUME~1\Owner\LOCALS~1\Temp
> USERDOMAIN                     VIRTUALVIAO
> USERNAME                       Owner
> USERPROFILE                    C:\Documents and Settings\Owner
> windir                         C:\WINDOWS
>
>
>
> PS Z:\> nrc -exec hello
> NetRexx portable processor, version 2.05
> Copyright (c) IBM Corporation, 2005.  All rights reserved.
> Program hello.nrx
> ===== Exec: hello =====
> hello
> Processing of 'hello.nrx' complete
>
>
> PS Z:\> $rxout = nrc -exec -nologo hello
> PS Z:\> $rxout[2]
> hello
> PS Z:\>
>
>
> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of rvjansen
> Sent: Thursday, June 28, 2012 8:07 AM
> To: IBM Netrexx
Hi Mike,

thanks for this. I gather you set the global environment using the
Windows dialog; what I am specifically looking for is the way to invoke
NetRexx using a batch file under PowerShell, so setting the environment
variables in the same batch file that is used to invoke the translator.

best regards,

René.


> Subject: Re: [Ibm-netrexx] NetRexx .Net - related
>
> Mike,
>
> would you have a sample of how to set the classpath and path in
> PowerShell scripts for NetRexx - for the Quick Start Guide that is
> nearing completion. There is something with the scope of the
> environment
> variables that I meant to find out but cannot find the time for.
>
> best regards,
>
> René.
>
>
> On 2012-06-28 14:10, Measel, Mike wrote:
>> Would any of you be interested in working on a parallel fork to have
>> NetRexx running native in .Net ?
>>
>> And would there be sufficient value in doing so ?
>>
>> My personal interest is in being able to interact directly with
>> windows components like you can do in powershell. I'd like to use
>> NetRexx directly from powershell and vice-versa.
>>
>> .Net code looks suspiciously like java.
>>
>> Perhaps Sir Thomas could write a translator. ( oh god what have I
>> started…)
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
> Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
> Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Re: NetRexx .Net - related

measel
Powershell is IMO, overly secure by default.  

Two ways to approach:  

1) Add this: Set-ExecutionPolicy Unrestricted
OR
2) Open text editor and paste your shell into it, so that the system thinks the file was created locally

The second is probably the better option, and then I would also just make it part of my powershell profile:

http://www.howtogeek.com/50236/customizing-your-powershell-profile/

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of rvjansen
Sent: Monday, July 02, 2012 9:20 AM
To: IBM Netrexx
Subject: [Ibm-netrexx] Fwd: Re: NetRexx .Net - related

I understand that my description of the problem is clear as mud, so let
me try to explain this. In Unix, an environment variable needs to be
explicitly exported to be used in a child process. This is done using
export (bash, ksh, etc) or setenv (tcsh, csh, etc).

In DOS bat and consequently the NT Shell, set will do it, and for the
rest of the session in that window, the values will keep.

In Powershell, however, we are more in unix-territory. When I run the
old style batchfile, subsequent runs of the nrc command do not find the
new values. It needs something more. Now when I do:


G:\>type envset.ps1
# set path for binaries
$env:path = "%path%;g:\bin;C:\Program
Files\IBM\WebSphere\AST\runtimes\base_v61_stub\java\bin"
$env:classpath = ".;g:\lib\NetRexxC.jar;g:\lib\tools.jar"

and run it with ./envset

I get a fairly unsympathetic message:

PS G:\> ./envset
File G:\envset.ps1 cannot be loaded because the execution of scripts is
disabled on this system. Please see "get-help about_signing" for more
details.
At line:1 char:9
+ ./envset <<<<
     + CategoryInfo          : NotSpecified: (:) [], PSSecurityException
     + FullyQualifiedErrorId : RuntimeException

but would this work on ordinary home systems?

best regards,

René.


-------- Original Message --------
Subject: Re: [Ibm-netrexx] NetRexx  .Net - related
Date: 2012-06-29 15:43
 From: rvjansen <[hidden email]>
To: IBM Netrexx <[hidden email]>
Reply-To: IBM Netrexx <[hidden email]>

On 2012-06-29 15:28, Measel, Mike wrote:

> René, from my XP system with powershell:
>
> PS Z:\> get-childitem env: | sort name
>
> Name                           Value
> ----                           -----
> ALLUSERSPROFILE                C:\Documents and Settings\All Users
> APPDATA                        C:\Documents and
> Settings\Owner\Application Data
> CLASSPATH
> c:\Netrexx\lib\NetRexxC.jar;c:\usr\java\tools.jar
> CLIENTNAME                     Console
> CommonProgramFiles             C:\Program Files\Common Files
> COMPUTERNAME                   VIRTUALVIAO
> ComSpec                        C:\WINDOWS\system32\cmd.exe
> FP_NO_HOST_CHECK               NO
> HOMEDRIVE                      C:
> HOMEPATH                       \Documents and Settings\Owner
> JAVA_HOME                      c:\program files\jdk\jdk1.5.0_22
> LM_LICENSE_FILE                C:\Program Files\HyPerformix\License;
> LOGONSERVER                    \\VIRTUALVIAO
> NUMBER_OF_PROCESSORS           4
> OS                             Windows_NT
> Path                           c:\program
>
> files\java\jdk1.5.0_22\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\Syste...
> PATHEXT
> .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.PSC1
> PROCESSOR_ARCHITECTURE         x86
> PROCESSOR_IDENTIFIER           x86 Family 6 Model 30 Stepping 5,
> GenuineIntel
> PROCESSOR_LEVEL                6
> PROCESSOR_REVISION             1e05
> ProgramFiles                   C:\Program Files
> PSModulePath                   C:\Documents and Settings\Owner\My
> Documents\WindowsPowerShell\Modules;C:\WINDOWS\sys...
> SESSIONNAME                    Console
> SystemDrive                    C:
> SystemRoot                     C:\WINDOWS
> TEMP                           C:\DOCUME~1\Owner\LOCALS~1\Temp
> TMP                            C:\DOCUME~1\Owner\LOCALS~1\Temp
> USERDOMAIN                     VIRTUALVIAO
> USERNAME                       Owner
> USERPROFILE                    C:\Documents and Settings\Owner
> windir                         C:\WINDOWS
>
>
>
> PS Z:\> nrc -exec hello
> NetRexx portable processor, version 2.05
> Copyright (c) IBM Corporation, 2005.  All rights reserved.
> Program hello.nrx
> ===== Exec: hello =====
> hello
> Processing of 'hello.nrx' complete
>
>
> PS Z:\> $rxout = nrc -exec -nologo hello
> PS Z:\> $rxout[2]
> hello
> PS Z:\>
>
>
> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of rvjansen
> Sent: Thursday, June 28, 2012 8:07 AM
> To: IBM Netrexx
Hi Mike,

thanks for this. I gather you set the global environment using the
Windows dialog; what I am specifically looking for is the way to invoke
NetRexx using a batch file under PowerShell, so setting the environment
variables in the same batch file that is used to invoke the translator.

best regards,

René.


> Subject: Re: [Ibm-netrexx] NetRexx .Net - related
>
> Mike,
>
> would you have a sample of how to set the classpath and path in
> PowerShell scripts for NetRexx - for the Quick Start Guide that is
> nearing completion. There is something with the scope of the
> environment
> variables that I meant to find out but cannot find the time for.
>
> best regards,
>
> René.
>
>
> On 2012-06-28 14:10, Measel, Mike wrote:
>> Would any of you be interested in working on a parallel fork to have
>> NetRexx running native in .Net ?
>>
>> And would there be sufficient value in doing so ?
>>
>> My personal interest is in being able to interact directly with
>> windows components like you can do in powershell. I'd like to use
>> NetRexx directly from powershell and vice-versa.
>>
>> .Net code looks suspiciously like java.
>>
>> Perhaps Sir Thomas could write a translator. ( oh god what have I
>> started…)
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
> Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
> Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/