Newbie - RUNPROGRAM Question

Please use this Board for QBasic related requests ( file research, programming, etc.)

Moderators:Administrator, Global Moderator

Post Reply
ZaoCix
Newbie
Posts:2
Joined:Mon Dec 16, 2002 3:12 am
Newbie - RUNPROGRAM Question

Post by ZaoCix » Mon Dec 16, 2002 3:34 am

I'm new to the programming field, and I figured QBasic was prolly as easy as it gets to learn some stuff. I've a couple questions... I'm trying to figure out how to run a program with certain perimeters, inside my program.

It starts out with the user entering an IP address. Once entered, my program takes the ip variable ( IP$ ) and enters it into the RUNPROGRAM parameters for NBTSTAT, which I want to do something like this...

RUN nbtstat - A IP$

So that it runs NBTSTAT with the -A parameters and pops in the IP from the variable. Now, I know this is prolly far from correct, but i'm new in the programming world so. I'm having kind of a hard time even explaining.

???

ZaoCix
Newbie
Posts:2
Joined:Mon Dec 16, 2002 3:12 am

Re: Newbie - RUNPROGRAM Question

Post by ZaoCix » Mon Dec 16, 2002 3:36 am

Oh and if someone gets the chance to answer could you happen to add some explanations so I can get a better idea of whats going on than simply telling me an answer  ;D thanks...

User avatar
frankiebaby
Global Moderator
Posts:95
Joined:Tue Apr 30, 2002 1:38 am
Location:Pennsylvania
Contact:

Re: Newbie - RUNPROGRAM Question

Post by frankiebaby » Mon Dec 16, 2002 3:22 pm

the problem is in the way qbasic's run statement works. it is designed to run a program without parameters. form the help on run:



 RUN "CATCHALL"

would execute CATCHALL.EXE from a BC-compiled program, and CATCHALL.BAS
from within QuickBASIC.

Programs running within the QuickBASIC environment must call only QuickBASIC program files. The file is loaded and run as if it were a QuickBASIC program; if it is not in the QuickBASIC program format, execution halts. The error message that appears varies, depending on the file's contents.


basically this says that if you are not compiling and running, in will not exucute a .exe file. then it is looking for a .BAS to run. so, what you must do is this:

use the shell command:


SHELL "what will go to dos prompt typed here"

or, in ur case

SHELL "nbtstat - A" + IP$

Jehovah
Jr. Member
Posts:24
Joined:Tue Oct 29, 2002 10:54 pm
Location:Boise, Idaho

Re: Newbie - RUNPROGRAM Question

Post by Jehovah » Wed Dec 18, 2002 10:48 pm

if nbtstat is your program, don't forget to use "Command$" to get the parameters you gave using the shell$ command (yup, shell is the only way to go).

Post Reply