Gordon

Distinguished
Apr 3, 2004
1,110
0
19,280
Archived from groups: comp.lang.basic.misc,microsoft.public.windowsxp.general (More info?)

I am attempting to write a program compiled with BC7 (PDS) on a Windows XP
system and want to shell to the Start command in order to start up the
default browser on an HTML file, but BC7 apparently cannot find or access
Start. I get the error message "Bad command or file name." Does anyone
know how to shell to Start in a BC7 program or, alternatively, how to
display (with the default browser) an HTML file from a BC7 program? Thanks.

Gordon
 
G

Guest

Guest
Archived from groups: comp.lang.basic.misc,microsoft.public.windowsxp.general (More info?)

Gordon wrote:
> I am attempting to write a program compiled with BC7 (PDS) on a Windows XP
> system and want to shell to the Start command in order to start up the
> default browser on an HTML file, but BC7 apparently cannot find or access
> Start. I get the error message "Bad command or file name." Does anyone
> know how to shell to Start in a BC7 program or, alternatively, how to
> display (with the default browser) an HTML file from a BC7 program? Thanks.

Not really familiar with BC7 (PDS) but does it support calling Windows
API's? If so, use the ShellExecute API found in shell32.dll, passing
the name of the HTML document as the lpFile parameter. Some
documentation at the following:

http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/reference/functions/shellexecute.asp

http://msdn.microsoft.com/archive/en-us/dnarvb4/html/msdn_shelexec.asp
http://support.microsoft.com/default.aspx?scid=kb;en-us;148632
http://www.developerfusion.co.uk/show/9/2/
--
Tom Porterfield
MS-MVP Windows
http://support.telop.org

Please post all follow-ups to the newsgroup only.
 
G

Guest

Guest
Archived from groups: comp.lang.basic.misc,microsoft.public.windowsxp.general (More info?)

Gordon wrote:
> I am attempting to write a program compiled with BC7 (PDS) on a Windows XP
> system and want to shell to the Start command in order to start up the
> default browser on an HTML file, but BC7 apparently cannot find or access
> Start. I get the error message "Bad command or file name." Does anyone
> know how to shell to Start in a BC7 program or, alternatively, how to
> display (with the default browser) an HTML file from a BC7 program? Thanks.
>
> Gordon

If the default browser is Windows Explorer, try the following:

Q$=CHR$(34)
W$="CMD /C START C:\"+Q$+"Program Files\Internet Explorer\IEXPLORE.EXE
"+Q$
SHELL W$
 
G

Guest

Guest
Archived from groups: comp.lang.basic.misc,microsoft.public.windowsxp.general (More info?)

"Tom Porterfield" <tpporter@mvps.org> wrote in message
news:uoctPrfuFHA.1032@TK2MSFTNGP12.phx.gbl...
> Gordon wrote:
> > I am attempting to write a program compiled with BC7 (PDS) on a Windows
XP
> > system and want to shell to the Start command in order to start up the
> > default browser on an HTML file, but BC7 apparently cannot find or
access
> > Start. I get the error message "Bad command or file name." Does anyone
> > know how to shell to Start in a BC7 program or, alternatively, how to
> > display (with the default browser) an HTML file from a BC7 program?
Thanks.

Shell a batch file
@REM mybatch.bas
start programname [parameters]


> Not really familiar with BC7 (PDS) but does it support calling Windows
> API's?

No.

MCM
 

Gordon

Distinguished
Apr 3, 2004
1,110
0
19,280
Archived from groups: comp.lang.basic.misc,microsoft.public.windowsxp.general (More info?)

Michael Mattias wrote:
> "Tom Porterfield" <tpporter@mvps.org> wrote in message
> news:uoctPrfuFHA.1032@TK2MSFTNGP12.phx.gbl...
>> Gordon wrote:
>>> I am attempting to write a program compiled with BC7 (PDS) on a
>>> Windows XP system and want to shell to the Start command in order
>>> to start up the default browser on an HTML file, but BC7 apparently
>>> cannot find or access Start. I get the error message "Bad command
>>> or file name." Does anyone know how to shell to Start in a BC7
>>> program or, alternatively, how to display (with the default
>>> browser) an HTML file from a BC7 program? Thanks.
>
> Shell a batch file
> @REM mybatch.bas
> start programname [parameters]
>
>
>> Not really familiar with BC7 (PDS) but does it support calling
>> Windows API's?
>
> No.
>
> MCM

Thanks for both responses. Michael makes an interesting suggestion which,
unfortunately, does not work ("Bad command or file name"). There is
something special about the Start command that makes it not accessible from
a Basic Shell command, whether or not Start is embedded in a batch file. It
seems that BC7 can shell to everything else, including internal commands
(e.g., 'dir') and external commands or programs (e.g., 'iexplore.exe'). (Of
course, BC7 is a 16-bit application dating from 1990.)

However, Michael's suggestion did trigger another idea, which was
successful: shell from BC7 to a compiled 32-bit console application
(compiled by G77, say) which itself shells to Start. One downside with this
roundabout approach is that it takes about 15 seconds for the browser window
to pop up. A direct command line execution of the 32-bit program pops up
the browser window in about 2 seconds.

Gordon
 
G

Guest

Guest
Archived from groups: comp.lang.basic.misc,microsoft.public.windowsxp.general (More info?)

The "start" on Win9x/ME systems is different from the "start" on Win
NT/2000/XP systems. On the Win9x systems it is implemented by an
executable START.EXE and has the syntax that Michael describes. On the
Win NT systems it is an internal command of CMD.EXE and has the syntax
that Gordon describes. In order to use it successfully with PDS 7 on NT
one needs to write a SHELL command like

LET URL$ = "http://www.google.com/"
SHELL "cmd /c " + CHR$(34) + "start " + URL$ + CHR$(34)

On my XP machine that starts up a browser window to Google from the
QBASIC interpreteer or from an exe compiled by VBDOS 1, so I would
expect it to work from a PDS 7 compiled exe as well.

Cheers

Derek
 
G

Guest

Guest
Archived from groups: comp.lang.basic.misc,microsoft.public.windowsxp.general (More info?)

The technique that I show above uses whatever browser has been set as
the default one

Cheers

Derek
 
G

Guest

Guest
Archived from groups: comp.lang.basic.misc,microsoft.public.windowsxp.general (More info?)

> Thanks for both responses. Michael makes an interesting suggestion which,
> unfortunately, does not work ("Bad command or file name"). There is

You know a lot of those 'bad command or filename' things in either real
MS-DOS or simulated MS-DOS occur when there is a space in the program name,
as in...

C:\program files\.......

.... or on some systems, trying to shell a 'longname' when you have to supply
the MS-DOS short name.

Then again, it's hard to tell from the code posted (none) how the SHELL'd
command was actually built...

MCM
 

Gordon

Distinguished
Apr 3, 2004
1,110
0
19,280
Archived from groups: comp.lang.basic.misc,microsoft.public.windowsxp.general (More info?)

Michael Mattias wrote:
> You know a lot of those 'bad command or filename' things in either
> real MS-DOS or simulated MS-DOS occur when there is a space in the
> program name, as in...
> C:\program files\.......

Right, but that is not the problem. The test program is in a directory
whose path has no spaces, and the directory names in the path have no more
than 8 characters. (Otherwise I would have used ~1 names.) For a minimal
example, all one needs is a compiled two-line Basic program
shell "dir"
shell "start"
The first shell command works, and the second one doesn't.

Gordon
 
G

Guest

Guest
Archived from groups: comp.lang.basic.misc,microsoft.public.windowsxp.general (More info?)

On Thu, 15 Sep 2005 09:03:36 -0400, Gordon wrote:

> I am attempting to write a program compiled with BC7 (PDS) on a Windows XP
> system and want to shell to the Start command in order to start up the
> default browser on an HTML file, but BC7 apparently cannot find or access
> Start. I get the error message "Bad command or file name." Does anyone
> know how to shell to Start in a BC7 program or, alternatively, how to
> display (with the default browser) an HTML file from a BC7 program? Thanks.
>
> Gordon

Gordon,
This might sound kinda stupid, but I've played around a bit and see the
following. The start command does not work if command.com is your DOS
shell, rather it works if cmd.exe is you DOS shell. Playing around with PDS
a bit, it looks like the SHELL command employs command.com regardless. Try
using SHELL "cmd /C start". I've tried it, and no errors and I get a new
window.

Hope this helps.

--
HK
 
G

Guest

Guest
Archived from groups: comp.lang.basic.misc,microsoft.public.windowsxp.general (More info?)

On Thu, 15 Sep 2005 16:14:01 -0600, H-Man wrote:

> On Thu, 15 Sep 2005 09:03:36 -0400, Gordon wrote:
>
>> I am attempting to write a program compiled with BC7 (PDS) on a Windows XP
>> system and want to shell to the Start command in order to start up the
>> default browser on an HTML file, but BC7 apparently cannot find or access
>> Start. I get the error message "Bad command or file name." Does anyone
>> know how to shell to Start in a BC7 program or, alternatively, how to
>> display (with the default browser) an HTML file from a BC7 program? Thanks.
>>
>> Gordon
>
> Gordon,
> This might sound kinda stupid, but I've played around a bit and see the
> following. The start command does not work if command.com is your DOS
> shell, rather it works if cmd.exe is you DOS shell. Playing around with PDS
> a bit, it looks like the SHELL command employs command.com regardless. Try
> using SHELL "cmd /C start". I've tried it, and no errors and I get a new
> window.
>
> Hope this helps.

Sorry guys, looks like I was late to the party and didn't even know it.

--
HK
 
G

Guest

Guest
Archived from groups: comp.lang.basic.misc,microsoft.public.windowsxp.general (More info?)

"Gordon" <gordon401nospam@comcast.net> wrote in message
news:kMudnXLfN8Z9OrTeRVn-qw@comcast.com...
> than 8 characters. (Otherwise I would have used ~1 names.) For a minimal
> example, all one needs is a compiled two-line Basic program
> shell "dir"
> shell "start"
> The first shell command works, and the second one doesn't.

That's because 'start' all by itself is invalid.

D:\Utility\Serializer\PPPS 3.0>start
Runs a Windows program or an MS-DOS program.

START [options] program [arg...]
START [options] document.ext

/m[inimized] Run the new program minimized (in the background).
/max[imized] Run the new program maximized (in the foreground).
/r[estored] Run the new program restored (in the foreground). [default]
/w[ait] Does not return until the other program exits.
 

Gordon

Distinguished
Apr 3, 2004
1,110
0
19,280
Archived from groups: comp.lang.basic.misc,microsoft.public.windowsxp.general (More info?)

Michael Mattias wrote:
> "Gordon" <gordon401nospam@comcast.net> wrote in message
> news:kMudnXLfN8Z9OrTeRVn-qw@comcast.com...
>> than 8 characters. (Otherwise I would have used ~1 names.) For a
>> minimal example, all one needs is a compiled two-line Basic program
>> shell "dir"
>> shell "start"
>> The first shell command works, and the second one doesn't.
>
> That's because 'start' all by itself is invalid.

No. Here is the syntax:
START ["title"] [/Dpath] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
[/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL]
[/WAIT] [/B] [command/program] [parameters]
All parameters are optional. Start by itself opens a command line window.
Try "start dir" if you prefer. I think we are getting off point here.
 
G

Guest

Guest
Archived from groups: comp.lang.basic.misc,microsoft.public.windowsxp.general (More info?)

se 'start' all by itself is invalid.
>
>No. Here is the syntax:
>START ["title"] [/Dpath] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
> [/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL]
> [/WAIT] [/B] [command/program] [parameters]
>All parameters are optional. Start by itself opens a command line window.
>Try "start dir" if you prefer. I think we are getting off point here.
> =======================

Here is the syntax shown on a Win98 system:

P1-C:\WINDOWS>start /?
Runs a Windows program or an MS-DOS program.

START [options] program [arg...]
START [options] document.ext

/m[inimized] Run the new program minimized (in the background).
/max[imized] Run the new program maximized (in the foreground).
/r[estored] Run the new program restored (in the foreground).
[default]
/w[ait] Does not return until the other program exits.

It apparently shows that a file name is required.

Jack
 

Gordon

Distinguished
Apr 3, 2004
1,110
0
19,280
Archived from groups: comp.lang.basic.misc,microsoft.public.windowsxp.general (More info?)

avanzino@usgs.gov wrote:
> Gordon wrote:
>> I am attempting to write a program compiled with BC7 (PDS) on a
>> Windows XP system and want to shell to the Start command in order to
>> start up the default browser on an HTML file, but BC7 apparently
>> cannot find or access Start. I get the error message "Bad command
>> or file name." Does anyone know how to shell to Start in a BC7
>> program or, alternatively, how to display (with the default browser)
>> an HTML file from a BC7 program? Thanks.
>>
>> Gordon
>
> If the default browser is Windows Explorer, try the following:
>
> Q$=CHR$(34)
> W$="CMD /C START C:\"+Q$+"Program Files\Internet Explorer\IEXPLORE.EXE
> "+Q$
> SHELL W$

A program has no way to know what the default browser is. There is no
problem shelling out to run a specific program, including Internet Explorer.
What I am trying to do is run the default browser (whatever it is).
 

Gordon

Distinguished
Apr 3, 2004
1,110
0
19,280
Archived from groups: comp.lang.basic.misc,microsoft.public.windowsxp.general (More info?)

J. Yazel wrote:
> se 'start' all by itself is invalid.
>>
>> No. Here is the syntax:
>> START ["title"] [/Dpath] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
>> [/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL |
>> /BELOWNORMAL] [/WAIT] [/B] [command/program] [parameters]
>> All parameters are optional. Start by itself opens a command line
>> window. Try "start dir" if you prefer. I think we are getting off
>> point here. =======================
>
> Here is the syntax shown on a Win98 system:
>
> P1-C:\WINDOWS>start /?
> Runs a Windows program or an MS-DOS program.
>
> START [options] program [arg...]
> START [options] document.ext
>
> /m[inimized] Run the new program minimized (in the background).
> /max[imized] Run the new program maximized (in the foreground).
> /r[estored] Run the new program restored (in the foreground).
> [default]
> /w[ait] Does not return until the other program exits.
>
> It apparently shows that a file name is required.

Not for WinXP, which is what I am running. The issue is not the syntax for
Start. The question is: can Basic shell out to run Start? Apparently the
answer is 'no'.
 

Gordon

Distinguished
Apr 3, 2004
1,110
0
19,280
Archived from groups: comp.lang.basic.misc,microsoft.public.windowsxp.general (More info?)

Derek wrote:
> The "start" on Win9x/ME systems is different from the "start" on Win
> NT/2000/XP systems. On the Win9x systems it is implemented by an
> executable START.EXE and has the syntax that Michael describes. On the
> Win NT systems it is an internal command of CMD.EXE and has the syntax
> that Gordon describes. In order to use it successfully with PDS 7 on
> NT one needs to write a SHELL command like
>
> LET URL$ = "http://www.google.com/"
> SHELL "cmd /c " + CHR$(34) + "start " + URL$ + CHR$(34)
>
> On my XP machine that starts up a browser window to Google from the
> QBASIC interpreteer or from an exe compiled by VBDOS 1, so I would
> expect it to work from a PDS 7 compiled exe as well.
>
> Cheers
>
> Derek

Thanks. That also works for PDS7, although with the same long delay that
occurs with my use of a 32-bit console program as a middleman. Presumably,
using a special console program is equivalent (for this purpose) to invoking
cmd.

Gordon
 

Gordon

Distinguished
Apr 3, 2004
1,110
0
19,280
Archived from groups: comp.lang.basic.misc,microsoft.public.windowsxp.general (More info?)

H-Man wrote:
> On Thu, 15 Sep 2005 16:14:01 -0600, H-Man wrote:
>
>> On Thu, 15 Sep 2005 09:03:36 -0400, Gordon wrote:
>>
>>> I am attempting to write a program compiled with BC7 (PDS) on a
>>> Windows XP system and want to shell to the Start command in order
>>> to start up the default browser on an HTML file, but BC7 apparently
>>> cannot find or access Start. I get the error message "Bad command
>>> or file name." Does anyone know how to shell to Start in a BC7
>>> program or, alternatively, how to display (with the default
>>> browser) an HTML file from a BC7 program? Thanks.
>>>
>>> Gordon
>>
>> Gordon,
>> This might sound kinda stupid, but I've played around a bit and see
>> the following. The start command does not work if command.com is
>> your DOS shell, rather it works if cmd.exe is you DOS shell. Playing
>> around with PDS a bit, it looks like the SHELL command employs
>> command.com regardless. Try using SHELL "cmd /C start". I've tried
>> it, and no errors and I get a new window.
>>
>> Hope this helps.
>
> Sorry guys, looks like I was late to the party and didn't even know
> it.

Not too late. You gave a nice explanation which was new.
 
G

Guest

Guest
Archived from groups: comp.lang.basic.misc,microsoft.public.windowsxp.general (More info?)

On Windows 2K & XP you can't SHELL to START, because START is not a
free standing program, but a function of the command line processor CMD.EXE.
However, the BASIC forms:

SHELL "cmd /c <program>" (wait for <program> to complete)

SHELL "cmd /c start <program>" (don't wait for <program> to complete)

will work correctly on these OS's.
--
Judson McClendon judmc@sunvaley0.com (remove zero)
Sun Valley Systems http://sunvaley.com
"For God so loved the world that He gave His only begotten Son, that
whoever believes in Him should not perish but have everlasting life."


"Gordon" <gordon401nospam@comcast.net> wrote:
>I am attempting to write a program compiled with BC7 (PDS) on a Windows XP
>system and want to shell to the Start command in order to start up the default
>browser on an HTML file, but BC7 apparently cannot find or access Start. I get
>the error message "Bad command or file name." Does anyone know how to shell
>to Start in a BC7 program or, alternatively, how to display (with the default browser)
>an HTML file from a BC7 program? Thanks.
>
> Gordon