Hi David,

The batch file works because Microsoft designed batch files to wait for
programs to end before running the next program.


On a technical level, Windows software uses the CreateProcess() API to
launch a new program. It returns a process handle, and you can then
choose to wait for this process to end by calling the
WaitForSingleObject() API to wait for the process handle to end. That's
great if you're running a Windows program, but it won't run MS-DOS
programs. To run a DOS program, you have to start up the DOS environment
by calling cmd.exe or by using a different API (aside from
CreateProcess()). I suspect that IBM's incoming remote command server
runs everything through a DOS API so that you can specify either a DOS
command or a Windows program, and it runs it.

The problem there is that the DOS interface does NOT give you a chance
to wait for a Windows program to end. It waits for DOS commands fine,
but Windows commands just start in the background.

You can see what I mean by opening up a DOS command and running a
windows program. e.g. c:\windows\notepad.exe -- you'll notice that
immediately after you type the commadn you get a new command prompt...
that's because the command prompt doesn't wait for windows programs
(like Notepad or Word) to end... it starts them then proceeds to the
next thing. If you want to wait for them to end, you need to write
Windows code that uses CreateProcess() and WaitForSingleObject().

However, when Microsoft wrote support for Batch files, they took it a
step further. They detected whether the command you're running was a
Windows program or not, and if it was, they wait for it to end.
(Basically, by calling CreateProcess(), et al, under the covers). Since
a Batch file *is* an MS-DOS program, you can run Word via a batch file,
and it'll wait for it.

Sorry if that was too long-winded. It's also a lot of guessing... I'm
not a Windows expert.

Anyway...

Why do you need a password to access network resources? Because,
Windows needs to send a userid/password to the network server (in this
case, the iSeries NetServer running on your System i).

Basically, when you run a command via RUNRMTCMD you're starting a 2nd session on the Windows PC (much in the way that you might have two sessions on i5/OS simply by opening two 5250 windows). That second session is kept separate from the interactive one where the user is logged on to the desktop. So, even though the user has already signed in to Windows with a userid/password, your RUNRMTCMD needs it's own userid/password in order to access the network, since it needs to know what userid/password to connect to network servers with.



David FOXWELL wrote:

Thanks Scott, I'm beginning to get there.

I notice that I can open Word with 'Start Winword.exe' but the
command doesn't wait for Word to be ended. I put the command in a
.bat and that way the i5 waits for Word to end. What's happening here
exactly?

Now, I want to open a Word document that's common to all users and
therefore stored in the IFS. I can only do it if I type my username
and password on the RUNRMTCMD. I don't need a password, however, to
open a document that's on my PC.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.