Re: del not working in .bat file
- From: "RB Smissaert" <bartsmissaert@xxxxxxxxxxxxxxxx>
- Date: Mon, 20 Nov 2006 22:42:58 -0000
Have tried now both with WSH and with the API, without a .bat file, but I can't make it work.
This is the API code, taken from Randy Birch's site:
Private Sub RunShell(cmdline As String, Optional lWindowStyle As Long)
Dim hProcess As Long
Dim ProcessId As Long
Dim exitCode As Long
'vbHide 0 - Window is hidden and focus is passed to the hidden window.
'vbNormalFocus 1 - Window has focus and is restored to its original size and position.
'vbMinimizedFocus 2 - Window is displayed as an icon with focus.
'vbMaximizedFocus 3 - Window is maximized with focus.
'vbNormalNoFocus 4 - Window is restored to its most recent size and position.
'The currently active window remains active.
'vbMinimizedNoFocus 6 - Window is displayed as an icon.
'The currently active window remains active.
'-------------------------------------------------------------------------------------
ProcessId = Shell(cmdline, lWindowStyle)
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, False, ProcessId)
Do
GetExitCodeProcess hProcess, exitCode
DoEvents
Loop While exitCode = STATUS_PENDING
CloseHandle hProcess
End Sub
And have run it like this:
RunShell strSQLiteEXE & " " & _
strFolder & "ReadCode.db <" & _
strFolder & "ReadCodeForSQLite.sql", vbHide
Either no file ReadCode.db gets created or strangely I get this file, but with a timestamp a few hours ago.
No idea what is going on there.
Also tried with WSH:
Set oShell = CreateObject("WSCript.Shell")
oShell.Run strSQLiteEXE & " ReadCode.db <ReadCodeForSQLite.sql", 1, True
Set oShell = Nothing
Looks simpler and neater, but same unpredictable result.
Also tried WSH with early binding, but same result.
When I use the API with the .bat file it runs fine, so maybe I need the .bat file and hopefully the API will
sort the wait out.
RBS
"Bob Butler" <tiredofit@xxxxxxxxxxx> wrote in message news:ufixfcODHHA.4404@xxxxxxxxxxxxxxxxxxxxxxx
"RB Smissaert" <bartsmissaert@xxxxxxxxxxxxxxxx> wrote in message
news:O1qsKQODHHA.952@xxxxxxxxxxxxxxxxxxxx
try running the sqllite command with
start /wait c:\....
Tried that now, but it just brings up the console window and nil else
happens.
Maybe just repeating the del command say 10 times will work.
Doesn't look very nice code though.
your best option is probably to lose the BAT file and use one of the various
"shell and wait" routines to run the sqllite command line.
--
Reply to the group so all can participate
VB.Net: "Fool me once..."
.
- Follow-Ups:
- Re: del not working in .bat file
- From: Jim Carlock
- Re: del not working in .bat file
- References:
- del not working in .bat file
- From: RB Smissaert
- Re: del not working in .bat file
- From: Bob Butler
- Re: del not working in .bat file
- From: RB Smissaert
- Re: del not working in .bat file
- From: Bob Butler
- Re: del not working in .bat file
- From: RB Smissaert
- Re: del not working in .bat file
- From: Bob Butler
- del not working in .bat file
- Prev by Date: Creating a Specially Formatted Word Document Through Visual Basic
- Next by Date: Re: del not working in .bat file
- Previous by thread: Re: del not working in .bat file
- Next by thread: Re: del not working in .bat file
- Index(es):
Relevant Pages
|