Announcement

Collapse
No announcement yet.

Starting Windows programs from DOS

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Starting Windows programs from DOS

    I want to shell a Windows program from a DOS executable that is
    run from Windows 95.Just using the command
    "Shell <program.exe>" returns the error
    "This program cannot be run in DOS mode"
    Also, I can not use "Shell start.exe <program.exe>".

    Any offers?

    ------------------

  • #2
    This PB/DOS v 3.5 program shells a PB/CC program just fine... or at least it did using PB/CC 2.0 under Win 98...

    (I did not put the date in my code, but the timestamp of this file is 9-15-99.)

    Code:
    $IF 0
     ShellCC.BAS
     Shell a PB/CC application from DOS program.
     This works fantastic! For GSG, a real timesaver?
    $ENDIF
    
    $LIB ALL OFF
    $ERROR ALL ON
    
    DIM ShellProgram AS STRING, CommandLine AS STRING
    
    COLOR 7,1
    
    CLS
    
    ShellProgram = "C:\SOFTWA~2\PBCC20\WORK\SORTFILE.EXE"
    PRINT "Press Any Key to Shell "; ShellProgram
    J$ = INPUT$(1)
    SHELL ShellProgram
    PRINT "end of job"
    END
    MCM
    Michael Mattias
    Tal Systems Inc. (retired)
    Racine WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      Andrew --

      It sounds to me like your computer has been booted in the DOS mode, so your program is not really being "run from Windows 95". Windows 95, 98, and ME systems can be started up in that way. When you boot in the DOS mode, Windows programs can't be run. You will need to boot the computer in the normal Windows mode, open a command prompt window (a "DOS box") to run your DOS program. Then it will be able to SHELL to other DOS programs, or to Windows programs.

      -- Eric


      ------------------
      Perfect Sync Development Tools
      Perfect Sync Web Site
      Contact Us: mailto:[email protected][email protected]</A>



      [This message has been edited by Eric Pearson (edited November 19, 2002).]
      "Not my circus, not my monkeys."

      Comment


      • #4
        ...or maybe the shortcut (.PIF or .LNK file) for the DOS app has the "Prevent application from detecting Windows" option enabled...?

        (The exact wording of that "Advanced" option escapes me at this precise moment).

        Right-click the shortcut you are using (or right-click the EXE if you are running it directly from Explorer) and check out the Advanced properties section.

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

        Comment


        • #5
          Hello,

          And if you are really in DOS, there are some DOS 'extensions' that sometimes allow non-GUI Windows exes to be run from DOS. If you need that, lemme know, once stumbled up on it and I must have those files somewhere on some PC.

          Best regards,
          Joep

          ------------------
          Joep

          http://www.diydatarecovery.nl
          Joep

          http://www.diydatarecovery.nl

          Comment


          • #6
            Are you referring to launching apps by file associations?

            For example, you can type "filename.doc" and that will launch the associated application for ".doc" files.

            You can do similar things under Windows NT/2000/XP through the SHELL statement, but only if the app launches CMD.EXE rather than COMMAND.COM, ie:

            SHELL "CMD.EXE /c filename.doc"

            Under Windows 9x, you can shell to START.EXE to perform a similar activity.


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

            Comment

            Working...
            X