Re: some WINDOWS cmds not working in ooRexx program?



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.







.



Relevant Pages

  • Re: Run:cmd gets error msg "Not a Win32 app." ... Weird!
    ... Did you do an Advanced Search for cmd.* to find every possible file? ... exists the i386 folder is used for WFP instead of the dllcache folder. ... Windows cannot find 'cmd.com' ... Run the System File Checker. ...
    (microsoft.public.windowsxp.general)
  • Re: lost normal.dot
    ... start it with the /a switch as recommended? ... >> file unless you change the options in Windows Explorer, Tools, Folder ... >> Data, Microsoft, Template folder. ...
    (microsoft.public.word.application.errors)
  • Re: Slipstreaming Service Packs
    ... What is the difference between using the /integrate switch and using ... Windows XP CD to a folder, but later I found the same basic instructions ... and other times when you must copy the entire installation CD? ... How do I slipstream a hot fix into the Windows installation files? ...
    (microsoft.public.windowsxp.general)
  • Re: cmd not available on windows xp sr 2
    ... MS-MVP Windows Shell/User ... > find the cmd file in the windows directory. ... > is not recognized by my other computers. ... > this computer but have an windows folder. ...
    (microsoft.public.windowsxp.general)
  • Re: And the leader in input devices is...
    ... >> able to dual boot Windows on their Mac minis" is a perfectly correct ... "Apple has announced the switch to Intel. ... >> case EVERY folder would be a virtual folder. ...
    (comp.sys.mac.advocacy)