Re: some WINDOWS cmds not working in ooRexx program?
- From: hs <hrmndrsingh@xxxxxxxxx>
- Date: Wed, 19 Sep 2007 19:23:31 -0700
On Sep 19, 7:38 am, Andreas Kieser <andr...@xxxxxx> wrote:
hs schrieb:
Andreas, I too have no problems in rexxtry, but I cannot change my
current dir through my ooRexx program when working in the cmd env.
That *should* be basically the same (although it may be eventually not
exactly in win32).
A little dir changing procedure:
-----------------------------------------
/* some dirchanges */
/* save current dir */
savedir = directory()
/* get some folders from system environment */
bootdrive = value('Systemdrive',,'ENVIRONMENT')
windir = value('windir',,'ENVIRONMENT')
progfiles = value('ProgramFiles',,'ENVIRONMENT')
say 'start folder:' savedir
say 'Boot drive: ' bootdrive
say 'Windows directory:' windir
say 'Program folder: ' progfiles
say
say 'changing to boot drive with shell command:'
'' || bootdrive -- just a drive change with a drive letter to cmd
say 'current dir:' directory()
say
say 'switch to Windows folder with directory:'
olddir = directory()
newdir = directory(windir) -- this directory exists for sure
call charout , 'now in: '
'dir | find /i "\"'
say
say 'switch back to folder before:'
call directory olddir
say 'current dir:' directory()
say
say 'change to program folder with cd:'
'cd' progfiles
say 'now in:' directory()
say
say 'back to start with cd'
'cd' savedir
say 'current directory:' directory()
-----------------------------------------
Saved as dir_changes.rex and run it yields this output on a XP-machine
with german environment:
D:\Programme\Script\Objects>dir_changes.rex
-------------------------------------------------
start folder: D:\Programme\Script\Objects
Boot drive: C:
Windows directory: C:\WINDOWS
Program folder: C:\Programme
changing to boot drive with shell command:
current dir: C:\
switch to Windows folder with directory:
now in: Verzeichnis von C:\WINDOWS
switch back to folder before:
current dir: C:\
change to program folder with cd:
now in: C:\Programme
back to start with cd
current directory: D:\Programme\Script\Objects
----------------------------------------------
D:\Programme\Script\Objects>
That displays the different ways to to change a directory *within* a
running rexx procedure. Pls note that all changes that took place within
the procedure are completely lost *outside* (after) the Rexx process -
nearly all environment changes affect only the process that manipulates
this environment (true for most Variables, directories, IPC and more).
Everything "outside" of the process is not affected.
When dealing with the cmdline (and not using the "short filename
feature") it may be necessary to enclose some folder names with
whitespace in them in double quotes - which turns out to be somewhat
troublesome in some cases.
Best,
Andreas
Rick, Andreas,
In view of this, I adopt the following alternative strategy to make my
cur dir (e.g.) C:\windows from wherever:
use a statement like
"start /Dc:\windows"
this essentially serves my purposes of using the REXX tools to change
my woking directory.
Many thanks for helping/guiding me to a good resolution.
Just by the way, the above opens a new cmd window, whereas the
following instead retains existing window, and is closer to previous
experience:
"start /Dc:\windows /b"
But it behaves quite differently to what I expect. E.g. when I run the
program from D:, it does make c:\windows my cur dir. But, if I then
issue the dir cmd, I get the details of D:
There must be an explanation, but I am ok with the resolution I have.
.
- References:
- some WINDOWS cmds not working in ooRexx program?
- From: hs
- Re: some WINDOWS cmds not working in ooRexx program?
- From: Rick McGuire
- Re: some WINDOWS cmds not working in ooRexx program?
- From: hs
- Re: some WINDOWS cmds not working in ooRexx program?
- From: Andreas Kieser
- some WINDOWS cmds not working in ooRexx program?
- Prev by Date: Re: Issue passing a stem to a function! used the value() function.
- Next by Date: REXX debugger
- Previous by thread: Re: some WINDOWS cmds not working in ooRexx program?
- Next by thread: Re: some WINDOWS cmds not working in ooRexx program?
- Index(es):
Relevant Pages
|