Well your using "CMD /K" which will Keep the window open. If you use the /C then it will close after processing. Is this enough of a solution r do you need it totally hidden?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Well your using "CMD /K" which will Keep the window open. If you use the /C then it will close after processing. Is this enough of a solution r do you need it totally hidden?
The windows closes after it finish execution. I want that to be totally hidden. This is a security measure. The DOS Window will display the FTP.txt file path which when revealed will help the user to browse the temp folder to fetch the user id and password for the server.
So I want the DOS window to be totally hidden. As I have &exit, the window will close as soon as the FTP job is done
The code solved the purpose of hiding the DOS Windows, BUT my current code have the functionality of trapping the DOS FTP Failures. Adding to that I have to Hide the DOS Window. If ShellExecute can solve both the purpose of capturing the DOS FTP failures and hiding the dos windows your valuable guidence is appreciated
This reads in the whole file. Then you could look for text using:
This would search every line for the text. If it is found, it would indicate the starting position. If it isn't found, it will return 0.
VB Code:
For x = 0 To UBound(str)
if instr(str(x),"Login Failed") > 0 then
msgbox "Failed"
exit for
endif
Next x
VB Code:
Option Explicit
Private Sub Form_Load()
Dim x As Integer, st As String
Dim ff As Integer
Dim strBuff As String
Dim str() As String
ff = FreeFile
Open App.Path & "\to do.txt" For Input As #ff
strBuff = Input(LOF(ff), ff)
Close #ff
str() = Split(strBuff, vbCrLf)
MsgBox "There are " & UBound(str) + 1 & " lines in the file"
After looking forward this approach, I am stuck as the Shell Command (as given by RobDog888) is not waiting. Searching this post gave me some result, but as a beginner I find it difficult to understand.
Can someone point out how to start the file search as given by dglienna after Shell Command (as given by RobDog888) is completely done in a Simple Fashion.
Value that is passed in the strCommand is
"ftp -s:C:\WINDOWS\Temp\FTP.txt > C:\WINDOWS\Temp\FTPLOG.txt &exit"
You can use the START /W process.exe to wait until a process finishes. You have to create a batch file for it to have any meaning, but the other alternative is a page of API's, which I would be able to show you, if I'm still awake.
You can use the START /W process.exe to wait until a process finishes. You have to create a batch file for it to have any meaning,
How do you do this?
Originally Posted by dglienna
but the other alternative is a page of API's, which I would be able to show you, if I'm still awake.
API is what is what that is making me afraid, But if you have the time to combine everything, that would be of great help. I do not want to trouble you much. I will have a look of the API
I think you have to shell a batch file, that calls another batch file, using Start /w, as I couldn't get it to pass any info using shell, shellexecute, or a dos command. I know it works, you can check it with Start /? from a command prompt.
Here is the alternative...
Last edited by RobDog888; Sep 22nd, 2005 at 08:57 AM.
Reason: Removing exe's in attachment