shell - why doesn't this work 
Author Message
 shell - why doesn't this work

Though I don't know off the bat how to get the listing you want, what

retval=shell("C:\directory\program.exe",1)

does is to shell out to (i.e., run) the program in quotes. Since you are
calling a function (shell( )), you have to assign it's return value to
something, even if you don't have any use for it. In this case, you return
the value (type Integer) of the called program to retval.


PGP Key ID 8A66A911
PGP fingerprint 5D 87 AF 72 91 9C 5A 17 47 01 A8 29 04 58 BC 07



Sun, 28 Feb 1999 03:00:00 GMT  
 shell - why doesn't this work

can any of you VB "xpurts" out there tell me what is wrong with
this line:
retval=shell("dir d:\projects\*.dat /s/b >filelist.tmp",1)

I get an error 53 "file not found"

I know when I was programming in QB 4.5, the following would
work:
shell "dir d:\projects\*.dat /s/b >filelist.tmp"

I am trying to get a list of all files with the extension .dat
in all of the subdirectories of d:\projects, so that I can
process the list. As far as I can tell, the DIR function in VB
(I am using 4.0) can not be used to read subdrectories as well.
I'd be open to any suggestions as to how to accomplish this.
Maybe there's a commercial product that has a function to do
this?

BTW, I am running win95, and the dir...etc works from the
command line (i.e. the DOS prompt)

Thanks in advance!!



Mon, 01 Mar 1999 03:00:00 GMT  
 shell - why doesn't this work

Quote:

>can any of you VB "xpurts" out there tell me what is wrong with
>this line:
>retval=shell("dir d:\projects\*.dat /s/b >filelist.tmp",1)

>I get an error 53 "file not found"

[znip]

"DIR" isn't a separate executable file and therefore Shell can't find it.
Shell meant slightly different things in DOS-BASICs.

Greetings,

 ----------------------------------------
| I don't believe in a no-win scenario.  |
|               - Admiral James T. Kirk  |
 ----------------------------------------



Mon, 01 Mar 1999 03:00:00 GMT  
 shell - why doesn't this work

Quote:

> can any of you VB "xpurts" out there tell me what is wrong with
> this line:
> retval=shell("dir d:\projects\*.dat /s/b >filelist.tmp",1)

> I get an error 53 "file not found"

> I know when I was programming in QB 4.5, the following would
> work:
> shell "dir d:\projects\*.dat /s/b >filelist.tmp"

> I am trying to get a list of all files with the extension .dat
> in all of the subdirectories of d:\projects, so that I can
> process the list. As far as I can tell, the DIR function in VB
> (I am using 4.0) can not be used to read subdrectories as well.
> I'd be open to any suggestions as to how to accomplish this.
> Maybe there's a commercial product that has a function to do
> this?

DIR is not a executable file itselft. It is a command available
from the COMMAND.COM file. Try this:
Result= Shell("COMMAND.COM /C dir d:\projects\*.dat /s/b >filelist.tmp")

Peter Larsson



Mon, 01 Mar 1999 03:00:00 GMT  
 shell - why doesn't this work

Quote:


> >can any of you VB "xpurts" out there tell me what is wrong with
> >this line:
> >retval=shell("dir d:\projects\*.dat /s/b >filelist.tmp",1)

> >I get an error 53 "file not found"
> [znip]

> "DIR" isn't a separate executable file and therefore Shell can't find it.
> Shell meant slightly different things in DOS-BASICs.

Try:

  retval=Shell(Environ("Comspec") & " /c dir d:\projects\*.dat /s/b

Quote:
>filelist.tmp", 1)

Later...   Karl


Mon, 01 Mar 1999 03:00:00 GMT  
 shell - why doesn't this work

Quote:

> can any of you VB "xpurts" out there tell me what is wrong with
> this line:
> retval=shell("dir d:\projects\*.dat /s/b >filelist.tmp",1)

> I get an error 53 "file not found"

DIR is *not* a file. <g>  You're requesting command.com to execute one
of its internal functions.  So, you need to recast your request:

  retval = Shell(Environ("Comspec") & " /c dir d:\projects\*.dat /s/b

Quote:
>filelist.tmp", 1)

Later...   Karl


Mon, 01 Mar 1999 03:00:00 GMT  
 shell - why doesn't this work

You can use the following API calls:

joyGetDevCaps
joyGetNumDevs
joyGetPos
joyGetPosEx
joyGetThreshold
joyReleaseCapture
joySetCapture
joySetThreshold

Or, Mabry software has a joystick OCX for $15.  you can download it from
their site.  

BEM



Mon, 01 Mar 1999 03:00:00 GMT  
 shell - why doesn't this work



Quote:

writes:

> >can any of you VB "xpurts" out there tell me what is wrong with
> >this line:
> >retval=shell("dir d:\projects\*.dat /s/b >filelist.tmp",1)

> >I get an error 53 "file not found"
> [znip]

> "DIR" isn't a separate executable file and therefore Shell can't find it.
> Shell meant slightly different things in DOS-BASICs.

In order for you to do what you want, you need to run a copy of command.com
with DIR as a parameter.

retval = shell("c:\command.com dir d:\projects\*.dat....etc.  BTW, this is
off the top of my head, so use with care.
--
Rick Clark



Sat, 06 Mar 1999 03:00:00 GMT  
 shell - why doesn't this work



Quote:

writes:

> >can any of you VB "xpurts" out there tell me what is wrong with
> >this line:
> >retval=shell("dir d:\projects\*.dat /s/b >filelist.tmp",1)

> >I get an error 53 "file not found"
> [znip]

> "DIR" isn't a separate executable file and therefore Shell can't find it.
> Shell meant slightly different things in DOS-BASICs.

In order for you to do what you want, you need to run a copy of command.com
with DIR as a parameter.

retval = shell("c:\command.com dir d:\projects\*.dat....etc.  BTW, this is
off the top of my head, so use with care.
--
Rick Clark

--- Internet Message Header Follows ---
Path:
sun.inform.dk!gn.apc.org!plug.news.pipex.net!pipex!tank.news.pipex.net!pipex!www.nntp.primenet.com!nntp.primenet.com!enews.sgi.com!news.mathworks....

Newsgroups: comp.lang.basic.visual.misc
Subject: Re: shell - why doesn't this work
Date: 17 Sep 1996 00:25:24 GMT
Organization: Flash-Net Internet Service Provider, 888-FLASHNET
Lines: 25



NNTP-Posting-Host: p-224.flash.net
X-Newsreader: Microsoft Internet News 4.70.1155

**************************************
        Sent via Inform-BBS
-Denmark's leading alternative network

**************************************



Sat, 06 Mar 1999 03:00:00 GMT  
 shell - why doesn't this work



Quote:



> writes:

> > >can any of you VB "xpurts" out there tell me what is wrong with
> > >this line:
> > >retval=shell("dir d:\projects\*.dat /s/b >filelist.tmp",1)

> > >I get an error 53 "file not found"
> > [znip]

> > "DIR" isn't a separate executable file and therefore Shell can't find
it.

> > Shell meant slightly different things in DOS-BASICs.

> In order for you to do what you want, you need to run a copy of
command.com
> with DIR as a parameter.

> retval = shell("c:\command.com dir d:\projects\*.dat....etc.  BTW, this
is
> off the top of my head, so use with care.
> --
> Rick Clark


Off the top of my hed (2 heds r better than 1) I think it's actually
retval=shell("command.com /c dir d:\projects\*.dat /s/b >filelist.tmp",1)
                                  ^^
The /c tells it to do that then quit. A better idea to do this might be to
use the Dir$ function to get a file list.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Nobody ever forgets where he buried the hatchet.

From the BaLiAl!





http://www.ozemail.com.au/~balial
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-



Mon, 08 Mar 1999 03:00:00 GMT  
 
 [ 12 post ] 

 Relevant Pages 

1. Why doesn't this Shell command work?

2. Why oh why doesn't this work?

3. Why LoadPicture() works on local pathes and doesn't work on the URLS

4. Shell command doesn't work under WinNT

5. WScript.Shell Run Doesn't Work???

6. Wscript.shell Run doesn't work

7. Shelling .HTM under NT Doesn't Work

8. Code doesn't work, why?

9. Why doesn't this MAPISendMail work?

10. Why doesn't this button work?

11. SQL in VB doesn't work - why?

12. Why doesn't this work?

 

 
Powered by phpBB® Forum Software