Subject Re: unable to execute dos
From Mervyn Bick <invalid@invalid.invalid>
Date Sun, 2 Oct 2022 14:04:12 +0200
Newsgroups dbase.getting-started

On 2022/10/02 12:23, Andy Taylor wrote:
> Hi Charlie,
>
> I've attached a picture of what happens when I type run into the windows
> DOS command window. Run is not a valid command in Windows 10 and I'm not
> sure it ever has been.  What version of windows is on your laptop?
> Type ver in your DOS command window to find out...
>
> The only situation that I can think of in which "run thumbs" would work
> in the DOS command window is if you have a program called run.exe in the
> same folder and thumbs is used as the parameter.
>
> Please type dir *.exe into the DOS command window and tell us what exe
> files get listed.
>
> Andy

Charlie isn't trying to physically execute thumbs.exe from a DOS window.
The RUN command in a dBASE form or program should execute outside of
dBASE any .exe, .com or .bat file passed to it.

On my computer RUN ( or ! which is equivalent) in the dBASE Command
Panel (or in a program) opens an Alert window with the message "Syntax
error".

RUN load_shed or ! load_shed opens a DOS window briefly (< 1 sec) and
then load_shed.exe opens in Windows.  load_shed.exe is a compiled dBASE
SDI form that includes shell(false,false) in the code so it opens
without showing the dBASE desktop.

If, with dBASE closed, I open a Command window, navigate to the folder
containing load_shed.exe and enter load_shed and press ENTER then the
form opens in Windows.

My guess is that, behind the scenes, RUN (or !) is implemented in dBASE
as a wrap to ShellExecute() in the Windows API.

Charlie, save the following as a .prg file.  Watch for line-wrap.  The
extern command must all be on one line.

****** Start *******
if type( "ShellExecute" ) # "FP"
   extern cHandle ShellExecute( cHandle, cString, cString,cString,
cString, cInt ) shell32 from "ShellExecuteA"
endif
ShellExecute(_app.framewin.hwnd,"open","thumbs.exe",null,null,1)
******** End ********

The little program assumes that thumbs.exe is in the same folder as the
program or the thumbs.exe folder is included in the PATH environmental
variable.

Copy the little program to the folder on a "good" containing your
program.  Run the little program just to see that it works.

Do the same on the "bad" computer.   If thumbs.exe is executed then it
means that the RUN command in dBASE has been corrupted.  A reinstall of
dBASE should sort this out.

If thumbs.exe is not executed (it won't give any error message) when you
run the little program on the "bad" computer it means that thumbs.exe is
not in the same folder as the program or it's folder is not in the PATH.
  Edit the little program so that "thumbs.exe" includes the path to
thumbs.exe.  If thumbs.exe still doesn't run it suggests a problem with
that copy of thumbs.exe.  If thumbs.exe is executed updating the PATH
variable should do the trick.

If none of the above work it points to a problem with shell32.dll in
Windows.  A reinstall of Windows should, however, really be a last resort.

Mervyn.