|
-
Jun 25th, 2000, 10:02 PM
#1
Thread Starter
New Member
I wrote a VB application for creating a .bat file by using the "Open File For Output As" method.
In the created .bat file an ftp function, ftp -s:TRAN.TXT, is called. I tried both Shell "ftp -s:TRAN.TXT" and RetVar = Shell ("c:\TRAN.TXT"), respectively, in the VB application (as the last line of code) but neither worked.
I checked the location of the TRAN.TXT file, which was sitting in c:\, the same path as the created .bat file.
The .bat file was created correctly because if the .bat file was executed manually, the ftp -s:tran.txt functiion would then be called and performed properly.
Thanks for anyone who can help me out.
-
Jun 25th, 2000, 10:15 PM
#2
_______
/
you can't shell a txt file you can only display it..
you need to shell the bat file
shell "C:\myfile.bat"
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Jun 25th, 2000, 11:33 PM
#3
Thread Starter
New Member
THANK YOU SO MUCH FOR THE QUICK RESPONSE.
I FORGOT TO MENTION IN MY QUESTION MESSAGE THAT I TRIED ALSO TO SHELL THE .BAT FILE, BUT IT DID NOT WORK, EITHER.
-
Jun 26th, 2000, 12:36 AM
#4
_______
..works for me...
Private Sub Command1_Click()
Shell "c:\cleaner.bat", vbNormalFocus
DoEvents
End Sub
'cleaner.bat (clean history and temp files
DELTREE /Y C:\WINDOWS\HISTORY\*.*
DELTREE /Y C:\WINDOWS\TEMPOR~1\*.*
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Jun 26th, 2000, 08:08 PM
#5
Thread Starter
New Member
Thanks again for your help. But I still cannot make it work.
For your refernece, the following is the application for creating the .bat file, plus the .txt file to be executed by a ftp command:
------------------------------------------------
Public Sub Main()
Dim BatchFile As String
Dim D
BatchFile = "C:\"
D = Format$(Date, "mmddyy")
Open BatchFile & "TRAN.bat" For Output As #1
Print #1, "ftp -s:TRANS.txt"
Print #1, ""
Print #1, "rename C:\CREDIT Cr" & D
Print #1, "rename C:\JSTORDR Js" & D
Print #1, ""
Print #1, "copy C:\Cr" & "*.*" & " C:\Info\"
Print #1, "copy C:\Js" & "*.*" & " C:\Info\"
Print #1, ""
Print #1, "Del C:\Cr" & D
Print #1, "Del C:\Js" & D
Close #1
Shell "ftp -s:" & "C:\TRAN.BAT"
End Sub
----------------------------------------------------
TRANS.txt
open mycompany
myuser
mypword
cd /tmp
get CREDIT
get JSTORDR
quit
---------------------------------------------------
Thank you.
-
Jun 26th, 2000, 08:29 PM
#6
_______
...
Shell "ftp -s:" & "C:\TRAN.BAT"
not sure on this line as I haven't really played with ftp.
did you try to shell the tran.bat file seperately to
see whether you are stuck on the ftp end or the shell?
Your create works fine so if you shell it, it should work...
'this will open and run the tran.bat and close the dos
'window when finished.
Wish I could be of more help but I am lost on ftp
Dim h As Long
h = Shell(Environ("COMSPEC") & " /C C:\Tran.bat")
DoEvents
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|