Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shell Execution Problem

Status
Not open for further replies.

fancom

Programmer
Feb 7, 2001
46
TR
Hi. I was triing to do some stuff on ms dos with qb using shell command.
When I type ;

Start > Run > cmd.exe

and then type

'ftype txtfile'

it runs but when I use command in qb;

'Shell "ftype txtfile"

it fails.

I really wonder why it doesn't work with qb while it works with cmd?

my MSDOS version is 5.0

Thanks a lot.

 
My first thought is memory. when running a qb program the
memory is limited when shelling, but from the command prompt or Start>run you probably have more memory available for the program.

Otherwise we would need to know more about the program(s)
to arrive at a valid conclusion
 
A little more explicit:

Shell "ftype.exe txtfile"

Add water (makes its own sauce).
 
i compiled hello.bas and ran it via shell and it worked fine
(XP) and used cmd.exe to get to the prompt then cd to the folder containing hello and typed hello and it worked fine.

So, don't know what to tell you unless im missing something here.
 
You might want to try and check your path. For instance; if you have your program that is using the SHELL command in the DOS directory, and the ftype program is in another directory (say the “utilities” directory) then the SHELL command will not work unless you specify the drive and path in your SHELL command. The command may look more like this:

SHELL "c:\utilities\ftype.exe txtfile"

Just replace “utilities” in the above example with the directory path to the ftype.exe program. And this will only work if the textfile is located in the same directory as the ftype.exe program; otherwise you will need to specify the path for the txtfile after the ftype.exe program just like you did with the program itself.

Hope this helps.
 
well I made windows search for ftype and it couldn't found it. Anyway, thanks a lot !!!
 
If you cannot find FTYPE command
but it apparently works
that means it is internal command of CMD.EXE
So you can call it as
CMD.EXE /C FTYPE txtfile

like this:
SHELL "CMD.EXE /C FTYPE txtfile"

(checked with QBasic on XP Prof SP2, it works )
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top