No announcement yet.

Windows 2000 & batches

  • Filter
  • Time
  • Show
Clear All
new posts

  • Windows 2000 & batches

    Sorry but another Windows 2000 problem which is driving me mad!

    Rather than SHELLing batch files (to PKZIP data for instance) I fill the keyboard buffer with the name of a batch file (+RETURN) and END the program. The batch file then does the business and when finished relaunches my programme. Works fine for clients using DOS (quite a few through choice!) and Windowz 98 (full screen).

    But I cannot get it to work in Windowz 2000 as when the programme ENDs the session terminates.

    I have tried setting up the window (always full screen) to 1) run the EXE, 2) run the BAT and 3) run a BAT which CALLs the BAT but in all cases the session terminates when the programme ENDs.

    The keyboard buffer bit works as I have tested TYPEing a file with it. And if I launch a DOS full screen session manually and run the EXE manually it all works fine.

    Can anybody help me before I go grey!



  • #2
    If I understand correctly, your app pokes data into the keyboard buffer then ends, right? For that to work, I expect your program would need to be a child app of the command-interpreter, or Windows will simply terminate the session without regard to the keyboard buffer...

    Therefore, the shortcut to your app should actually be a shortcut to COMMAND.COM, and in turn provide your app's name as a parameter of that, thus:
    C:\WINNT\SYSTEM32\COMMAND.COM /C appname.exe
    However, in my brief tests, Windows 2000 complains about an invalid path or corrupt PIF file (even if they are fully qualified or missing, etc).

    In any case, that approach is a far from robust method of launching a child program, and would need to be configured on a per-system basis. Ugh!

    Therefore I'd be rather inclined to write a very short PB/CC application that does the SHELL control, etc, just for these Windows users... it would look something like this:
      SHELL "App1.EXE"   ' synchronous shell to run the 1st app
      SHELL ENVIRON$("COMSPEC") + " /c Batch1.BAT" ' run the bat file
      SHELL "App2.EXE"   ' another synchronous SHELL to the 2nd app
      ' etc...

    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    mailto:[email protected]


    • #3
      CALLing a batch file also spawns a new command shell, and is less unweildy than explicitly calling command with a list of parameters.