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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

shell doesn't seem to work

Status
Not open for further replies.

dejfatman

Programmer
Jan 24, 2002
34
0
0
US
I'm coding an application that must run a .bat. I'm trying to use Shell, but nothing seems to happen - no error, etc. Here is a code snippit of a simple test I tried which still did not work.

strFTPCommand = "T:/Table Maintainer/battype.bat"
Call Shell(strFTPCommand,vbMinimizedFocus)

battype.bat contents: type ftpnt.bat > ftpnt.txt

I've tried putting the text directly in the shell call, and I've even tried putting the .bat file contents in the shell call, but nothing seems to happen. The .bat file does work if I execute from a command prompt. Can anyone tell me what I'm doing wrong?
 
Similar problem I had, put this in your batch file:

T:
cd Table Maintainer
type ftpnt.bat > ftpnt.txt


 
Thanks, I tried that, as well as fully qualifying the files in the .bat, but it still doesn't work. Here is some more detail.

strDir = "T:/Table Maintainer/"
...
strFTPCommand = strDir & "battype.bat"
MsgBox strFTPCommand
dbShell = Shell(strFTPCommand, vbMinimizedFocus)
MsgBox dbShell

I'm not sure what the double value is that Shell returns, but when I run, I get the first msgbox = "T:/Table Maintainer/battype.bat", then my second msgbox is always some random 3 digit number (maybe a task number?) like "302". I'm not getting any error message like "File not found", and I am getting the returned double out of shell which seems to imply it actually tried to execute the batch, so I am completely confused as to why it won't work. I'm running Access 2000 on an NT box if that matters.
 
Never mind, I was being stupid. The folder name "Table Maintainer was causing the problem. I put """" & ... & """" around the .bat name and it worked.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top