Close .bat file

M

Martin

Hello,

I have some code that tests to see if Notepad is open:

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal
lpClassName As String, ByVal lpWindowName As String) As Long

Sub CheckNotepad()
Dim hwnd As Long

hwnd = FindWindow("Notepad", vbNullString)
If hwnd <> 0 Then
MsgBox "Notepad is running"
Else
MsgBox "Notepad is not running"
End If
End Sub

I would like to amend this to check if a .bat file is open and if it is then
close it.

Does anyone know how to do this? I cant figure out how to change this code
to do that.

Many thanks in advance.

Martin
 
M

Martin

Stefan,

I have a split database being used by 100 users over 3 locations. I have
access to a server that everyone else can access (I work in a large company
and most deartments have their own servers). I run a bat file to copy the
front end from the shared server to the c:\temp folder. Sometimes this front
end changes so I get the users to use a link to run the bat file to copy the
latest front end version.

When the bat file runs it kills the previous copy, copies the server copy to
the c:\temp and then calls the c:\Temp mdb file. The DOS prompt window only
closes when you close the database down. I have tried the EXIT command in
the bat file but this still doest work until the database has closed down.

Not an important point but it seems to annoy my users!

This was the best was I could think of distributing the front end database.

Martin
 
S

Stefan Hoffmann

hi Martin,
I run a bat file to copy the
front end from the shared server to the c:\temp folder. Sometimes this front
end changes so I get the users to use a link to run the bat file to copy the
latest front end version.
Set in the link file the run as minimized window and use the Start
command to start an detached process:

Start MSACCESS.EXE "%DESTINATION%"


mfG
--> stefan <--
 
S

Stefan Hoffmann

hi,

Stefan said:
Set in the link file the run as minimized window and use the Start
command to start an detached process:
Use the Start command in the batch, not in the link...



mfG
--> stefan <--
 
M

Martin

Thank you both for your advice. I have both working, which is much
appreciated.

Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top