[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Re: Portable NB batch file



** Reply to message from Michael Norman 
on Thu, 18 Sep 2008 15:32:02 -0400


> When I run the .bat, I get the dialog:
>
> *Can't run 16-bit Windows program
>  The path Z:\NBLAUNCH.EXE is invalid.*
>
> But there is no nblaunch.exe. And here's something interesting: the
> .bat begins an NTVDM session anyway. Because when I try it a second
> time, I get an NB dialog that says: *Error starting (8) Insufficient
> memory Z:\NBEDITOR.EXE* which, as you once pointed out, you have to
> kill with Process Explorer.

Yes, you're right, I see all that too. Hmmmm. You know,
there's nothing wrong with that (100% ordinary) BATchfile -- it
executes DOS commands perfectly in Z:\ (which is the extent to
which I tested it). If the BATfile issues a CD command, it
returns "Z:\" (because "CD" by itself always returns the current
dir) -- so it is located where it is supposed to be.  If you do
a DIR, you see all the NB files on Z:\. If you halt the BATfile
right there, and you issue a NOTABENE.EXE command manually, NB
launches! If I replace NOTABENE.EXE with EDITOR.EXE and point
at a XyWrite directory instead of NB's directory, XyWrite
launches via the BATchfile. Everything, in short, is normal and
the BATchfile executes correctly. So what gives?

Bah! It's just that NOTABENE.EXE is a stupid shell command,
used for no particular purpose; the real program is
NBEDITOR.EXE. Yikes. Dumb dumb dumb. NOTABENE.EXE terminates
in less than a second, passing control to NBEDITOR.EXE; but the
BATfile thinks NB isn't running anymore so it kills the
SUBSTitute drive and you get the errors. So here, use this
instead (beware line wraps on long lines below!!!), and be
*sure* to launch it with START /MIN LAUNCHNB.BAT (that way it
won't tie up use of your DOS session but will operate instead as
an independent process; and also it will EXIT on termination,
killing it's own VDM, and you don't want it to kill your parent
DOS session instead). And again, Michael, you really REALLY
want to write that NotaBene installation on your portable drive
(thumb drive, or whatever) as a fresh install, which thinks it
is truly running in Z:\. So MANUALLY create a Z: drive, or
assign your thumb to Z: in Computer Management, install and
update NB in the root directory of Z:, then reassign the thumb
to it's original driveletter, XCOPY all the NB directories and
files on the thumb to a unique directory on the thumb named
differently than the NB directory on your hard drive e.g.
d:\NBTHUMB, set that unique directory name as the "\NBFOLDER" in
this BATchfile, and finally test the BATchfile. Do you get the
logic here? You install in the root of Z:, but you must then
move all the files on the thumb to a subdirectory (preserving
the dir structure exactly with "XCOPY /E /H") so that when you
plug the thumb into a foreign computer, it can find the damn
files -- or you could also just leave everything in the root,
but you'd have to adjust this BATfile -- maybe that's actually
simpler, but it would put the entire content of the thumb, not
just the NB installation, on Z:, which gobbles up memory. Of
course, if you have a thumb dedicated ONLY to NB, then you're
OK... There are lots of ways to skin this cat... But it will
work:

==============================
@echo off
setlocal
::
:: --------------------------
:: LAUNCHNB.BAT for Portable Nota Bene RJHolmgren 4 Dec 2004
Rev.19 Sept 08
:: Command at a DOS Prompt: START /MIN [d:\path\]LAUNCHNB.BAT
::
::SET variable NBFOLDER below to the "\PATH" where NB is located
set NBFOLDER=\NBTHUMB
:: --------------------------
::
if not exist Z:\ goto b
echo Drive Z: already in use! Aborting...
goto :eof
:b
for %%a in (C D E F G H I J K L M N O P Q R S T U V W X Y) do (
 if exist %%a:%NBFOLDER%\SWSYS.DLL (
  subst Z: %%a:%NBFOLDER%
  pushd Z:\
  echo NotaBene is running...
  start /min /wait Z:\NBEDITOR.EXE
  popd
  subst Z: /D
  exit
 ) )
echo NotaBene portable installation not found
goto :eof
==============================

-----------------------------
Robert Holmgren
holmgren@xxxxxxxx
-----------------------------