Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Tue Nov 12, 2019 4:15 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Shell "DIR" command fails in Win7
PostPosted: Wed Sep 12, 2012 7:47 pm 
Offline

Joined: Sat Jan 12, 2008 12:54 pm
Posts: 36
Code snippet:
Dim s As Shell
s = New Shell
s.Execute "DIR C:\*.wmv /s /n /b"


(meaning: list the names of all files on the hard drive having the .wmv file extension.
"/s" means search subfolders; "/b" means omit headers and summaries; "/n" asks for the output in a particular format.)

It returns error code -2, which means file not found.

I have tried it without the /b and /n switches -- it still fails. The "/z" is necessary,
unless I want to crawl the directory tree myself -- which I have coded, in order to
get around this problem.

The same command executes perfectly in a Command window.

Am I doing something wrong, or is Shell at fault?


Top
 Profile  
Reply with quote  
 Post subject: Re: Shell "DIR" command fails in Win7
PostPosted: Wed Sep 12, 2012 8:39 pm 
Offline
User avatar

Joined: Mon Apr 02, 2007 2:08 am
Posts: 1225
Location: San Francisco, CA, USA
You probably need to increase the shell's TimeOut period; by default the timeout is 2 seconds, which is far too short to expect that command to have finished.

_________________
Boredom Software


Top
 Profile  
Reply with quote  
 Post subject: Re: Shell "DIR" command fails in Win7
PostPosted: Wed Sep 12, 2012 8:52 pm 
Offline

Joined: Sat Jan 12, 2008 12:54 pm
Posts: 36
Thanks very much! That was the problem.
One wonders, though, why there isn't an error code that says "Timed out."
Anyway, I'll remember it next time.
Thanks again.


Top
 Profile  
Reply with quote  
 Post subject: Re: Shell "DIR" command fails in Win7
PostPosted: Wed Sep 12, 2012 10:54 pm 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
Quote:
It returns error code -2, which means file not found.

Most likely, -2 means "timed out". The Shell doesn't return an actual error code on Windows. Just zero (success) or -1 (failure).


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group