DavidWare
asked on
End a batch file
Hello Experts,
I an typically making changes to the .MDB weekly.
I want those changes to go into effect the next time a user fires up my .MDE, so I compile it to the network, and have the users execute a batch file that copies the new .MDE to their local work stations, then fires up the latest version of the .MDE.
The problem is, my batch file won't end until the user terminates the .MDE.
Is there a way to force the batch file to end and close while the .MDE is still running?
here is the batch file:
*********
copy "O:\MyDir\MyOtherDir\MyPro gram.mde" "C:\Program Files\MyDir\MyOtherDir\MyP rogram.mde " /y
"C:\Program Files\MyDir\MyOtherDir\MyP rogram.mde "
*********
Thanks,
David
I an typically making changes to the .MDB weekly.
I want those changes to go into effect the next time a user fires up my .MDE, so I compile it to the network, and have the users execute a batch file that copies the new .MDE to their local work stations, then fires up the latest version of the .MDE.
The problem is, my batch file won't end until the user terminates the .MDE.
Is there a way to force the batch file to end and close while the .MDE is still running?
here is the batch file:
*********
copy "O:\MyDir\MyOtherDir\MyPro
"C:\Program Files\MyDir\MyOtherDir\MyP
*********
Thanks,
David
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Try START first - I'm fairly certain it will work.
ASKER
Hello leew and Cactus_Data
leew,
start does end the first command prompt session, but it opens another one in the C:\Program Files\MyDir\MyOtherDir directory
(My cursor is: C:\Program Files\MyDir\MyOtherDir>_ )
gustav,
I think you are suggesting that I have 2 seperate shortcuts:
1) one to copy the .MDE over from the network to the local drive, and
2) a completely seperate shortcut for executing the .MDE.
Am I right?
If so. that is not my goal.
I want the users to
1) double-click the icon and have my batch file copy the .MDE over from the network to the local drive AND EXECUTE THE .MDE all in the same batch file.
Only one shortcut, please.
The question that will get the points is "Is there a way to force the batch file to end and close while the .MDE is still running?"
Thanks,
David
leew,
start does end the first command prompt session, but it opens another one in the C:\Program Files\MyDir\MyOtherDir directory
(My cursor is: C:\Program Files\MyDir\MyOtherDir>_ )
gustav,
I think you are suggesting that I have 2 seperate shortcuts:
1) one to copy the .MDE over from the network to the local drive, and
2) a completely seperate shortcut for executing the .MDE.
Am I right?
If so. that is not my goal.
I want the users to
1) double-click the icon and have my batch file copy the .MDE over from the network to the local drive AND EXECUTE THE .MDE all in the same batch file.
Only one shortcut, please.
The question that will get the points is "Is there a way to force the batch file to end and close while the .MDE is still running?"
Thanks,
David
Can you post the batch file. Start should work.
> I think you are suggesting that I have 2 seperate shortcuts
I wonder why? This is what I wrote:
Create a shortcut to run the copy and launch process.
We use this method at those of our clients with POS applications; these just have to work.
We even put the shortcut in the Start folder.
/gustav
I wonder why? This is what I wrote:
Create a shortcut to run the copy and launch process.
We use this method at those of our clients with POS applications; these just have to work.
We even put the shortcut in the Start folder.
/gustav
ASKER
Hello leew and gustav,
First, thanks again for the followup. I intend to increase the points and split them.
leew,
the batch fril is just as you posted:
copy "O:\MyDir\MyOtherDir\MyPro gram.mde" "C:\Program Files\MyDir\MyOtherDir\MyP rogram.mde " /y
start "C:\Program Files\MyDir\MyOtherDir\MyP rogram.mde "
The first command window opens and copies the .MDE from the network to the local drive, then closes.
But then another command window opens with the following text in the blue bar at the top:
C:\Program Files\MyDir\MyOtherDir\MyP rogram.mde
and the following text in the command window:
Microsoft Windows 2000 [Version 5.00.2195]
(C) Copyright 1985-2000 Microsoft Corp
O:\MyDir\MyOtherDir>
and the cursor blinking to the right of the O:\MyDir\MyOtherDir>
*** my mistake in the previous post when I wrote: "(My cursor is: C:\Program Files\MyDir\MyOtherDir>_ )"
Actually My cursor is: O:\MyDir\MyOtherDir> ***
gustav,
Forgive me, but I am not understanding the instructions.
you said:
Create a shortcut to run the copy and launch process.
Choose tab Program.
Set Command line to: "C:\Program Files\MyDir\MyOtherDir\MyP rogram.mde "
Set Batch file to: <path and name of your batch file>
Mark Close when finished/terminated.
First, when I create a shortcut, there are no Tabs, simply a textbox for the full file name, and a Browse button. Then a textbox for the name.
So, I create a shortcut, then (once it's created), I open it's properties.
Now I have Tabs, but none called "Program".
So, selecting the "Shortcut" tab, I enter the full file name of the program, as you wrote:
"Set Command line to: 'C:\Program Files\MyDir\MyOtherDir\MyP rogram.mde '"
Now, your instruction: "Set Batch file to: <path and name of your batch file>" is completely confusing.
There is no place to reference a Batch File in the shortcut properties.
There is a place to reference the "Start In" directory, but that will not accept a full file name.
The error says that "The Folder... is not valid". This "Start In" is looking for a Directory only.
So, as you can see, I am trying to follow your instructions, but your syntax seems to be non sequitur.
David
First, thanks again for the followup. I intend to increase the points and split them.
leew,
the batch fril is just as you posted:
copy "O:\MyDir\MyOtherDir\MyPro
start "C:\Program Files\MyDir\MyOtherDir\MyP
The first command window opens and copies the .MDE from the network to the local drive, then closes.
But then another command window opens with the following text in the blue bar at the top:
C:\Program Files\MyDir\MyOtherDir\MyP
and the following text in the command window:
Microsoft Windows 2000 [Version 5.00.2195]
(C) Copyright 1985-2000 Microsoft Corp
O:\MyDir\MyOtherDir>
and the cursor blinking to the right of the O:\MyDir\MyOtherDir>
*** my mistake in the previous post when I wrote: "(My cursor is: C:\Program Files\MyDir\MyOtherDir>_ )"
Actually My cursor is: O:\MyDir\MyOtherDir> ***
gustav,
Forgive me, but I am not understanding the instructions.
you said:
Create a shortcut to run the copy and launch process.
Choose tab Program.
Set Command line to: "C:\Program Files\MyDir\MyOtherDir\MyP
Set Batch file to: <path and name of your batch file>
Mark Close when finished/terminated.
First, when I create a shortcut, there are no Tabs, simply a textbox for the full file name, and a Browse button. Then a textbox for the name.
So, I create a shortcut, then (once it's created), I open it's properties.
Now I have Tabs, but none called "Program".
So, selecting the "Shortcut" tab, I enter the full file name of the program, as you wrote:
"Set Command line to: 'C:\Program Files\MyDir\MyOtherDir\MyP
Now, your instruction: "Set Batch file to: <path and name of your batch file>" is completely confusing.
There is no place to reference a Batch File in the shortcut properties.
There is a place to reference the "Start In" directory, but that will not accept a full file name.
The error says that "The Folder... is not valid". This "Start In" is looking for a Directory only.
So, as you can see, I am trying to follow your instructions, but your syntax seems to be non sequitur.
David
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hello gustav,
Well, we're getting closer.
I created the .PIF shortcut, and edited it as follows:
Program Tab
Cmd line: "C:\Program Files\MyDir\MyOtherDir\MyP rogram.mde "
Working: "C:\Program Files\MyDir\MyOtherDir"
Batch File: "O:\MyDir\MyOtherDir\Updat eAndRunMag Program.ba t
So when I run it, the error tells me:
C:\DOCUME~1\DavidWare\Desk top\MyProg ram.pif
C:\Program Files\MyDir\MyOtherDir\MyP rogram.mde .
The file is not a valid MS-DOS program file.
MS-DOS program files must end with the extension .EXE, .COM, or .BAT.
So I tried putting just the batch file in as the CmdLine and the Command window opens for a flash but closes w/o copying or running the .MDE.
I tried substituting "O:\MyDir\MyOtherDir" in as the "Working" directory, but when there is an .MDE file listed as the "Cmd line" file, it fails with the above copied error.
It looks like it wants the .BAT file in as the "Cmd line" but that does nothing besides flash the Dos window at me.
What am I doing wrong?
Thanks,
David
Well, we're getting closer.
I created the .PIF shortcut, and edited it as follows:
Program Tab
Cmd line: "C:\Program Files\MyDir\MyOtherDir\MyP
Working: "C:\Program Files\MyDir\MyOtherDir"
Batch File: "O:\MyDir\MyOtherDir\Updat
So when I run it, the error tells me:
C:\DOCUME~1\DavidWare\Desk
C:\Program Files\MyDir\MyOtherDir\MyP
The file is not a valid MS-DOS program file.
MS-DOS program files must end with the extension .EXE, .COM, or .BAT.
So I tried putting just the batch file in as the CmdLine and the Command window opens for a flash but closes w/o copying or running the .MDE.
I tried substituting "O:\MyDir\MyOtherDir" in as the "Working" directory, but when there is an .MDE file listed as the "Cmd line" file, it fails with the above copied error.
It looks like it wants the .BAT file in as the "Cmd line" but that does nothing besides flash the Dos window at me.
What am I doing wrong?
Thanks,
David
You need the full command line, like:
Cmd line: "C:\Program Files\Microsoft Office\Access\MsAccess.exe " "C:\Program Files\MyDir\MyOtherDir\MyP rogram.mde "
/gustav
Cmd line: "C:\Program Files\Microsoft Office\Access\MsAccess.exe
/gustav
ASKER
Hello gustav,
Thanks for replying.
The shortcut opens the local copy of the .MDE, but it's last week's version.
This week's version of the program is not being copied from the network first.
Cmd line: "C:\Program Files\Microsoft Office\Office\MSAccess.exe " "C:\Program Files\MyDir\MyOtherDir\MyP rogram.mde "
Working: "C:\Program Files\MyDir\MyOtherDir"
Batch File: O:\MyDir\MyOtherDir\Update AndRunMyPr ogram.bat
UpdateAndRunMyProgram.bat contains the command:
copy "O:\MyDir\MyOtherDir\MyPro gram.mde" "C:\Program Files\MyDir\MyOtherDir\MyP rogram.mde " /y
In other words, the shortcut doesn't copy the new version of the file (from the network to the local drive) before executing the local copy.
I assume that the shortcut is executing the local copy first, then is unable to overwrite the locan .MDE, because it's in use.
(As a result, I assume, the Command window stays open while the local copy is running - which is the reason for this question in the first place).
Any ideas on how to get the .BAT file to execute first (copying over this week's version of the .MDE), and then execute the .MDE?
Thanks,
David
Thanks for replying.
The shortcut opens the local copy of the .MDE, but it's last week's version.
This week's version of the program is not being copied from the network first.
Cmd line: "C:\Program Files\Microsoft Office\Office\MSAccess.exe
Working: "C:\Program Files\MyDir\MyOtherDir"
Batch File: O:\MyDir\MyOtherDir\Update
UpdateAndRunMyProgram.bat contains the command:
copy "O:\MyDir\MyOtherDir\MyPro
In other words, the shortcut doesn't copy the new version of the file (from the network to the local drive) before executing the local copy.
I assume that the shortcut is executing the local copy first, then is unable to overwrite the locan .MDE, because it's in use.
(As a result, I assume, the Command window stays open while the local copy is running - which is the reason for this question in the first place).
Any ideas on how to get the .BAT file to execute first (copying over this week's version of the .MDE), and then execute the .MDE?
Thanks,
David
ASKER
Tried creating 2 .BAT files - one to copy the file and one to execute it.
Cmd line: O:\MyDir\MyOtherDir\Update MyProgram. bat
Working: O:\MyDir\MyOtherDir
Batch File: O:\MyDir\MyOtherDir\RunMyP rogram.bat
And the Command window flashes, but the file is not copied over, and the .MDE does not run.
I'm confident of the syntax. Also tried it with quotes.
Then I tried JUST copying the file over:
Cmd line: O:\MyDir\MyOtherDir\Update MyProgram. bat
Working: O:\MyDir\MyOtherDir
Batch File:
And the same thing (a milli-second flash of the Command window) occurs.
By the way, if I execute O:\MyDir\MyOtherDir\Update MyProgram. bat from Windows Explorer, the Command window stays open for a full 2 secongs, and the file is copied to the local drive. Executing the shortcut that calls the same .BAT file fails.
Any ideas?
Thanks,
David
Cmd line: O:\MyDir\MyOtherDir\Update
Working: O:\MyDir\MyOtherDir
Batch File: O:\MyDir\MyOtherDir\RunMyP
And the Command window flashes, but the file is not copied over, and the .MDE does not run.
I'm confident of the syntax. Also tried it with quotes.
Then I tried JUST copying the file over:
Cmd line: O:\MyDir\MyOtherDir\Update
Working: O:\MyDir\MyOtherDir
Batch File:
And the same thing (a milli-second flash of the Command window) occurs.
By the way, if I execute O:\MyDir\MyOtherDir\Update
Any ideas?
Thanks,
David
> the shortcut doesn't copy the new version of the file (from the network to the local drive) before executing the local copy.
That's strange. It works nicely at our clients.
The batch file should run initially - that's the purpose of it also according to the on-line help.
/gustav
That's strange. It works nicely at our clients.
The batch file should run initially - that's the purpose of it also according to the on-line help.
/gustav
ASKER
Well, I didn't solve it, but I'm convinced that I'm doing something wrong, and I will continue to work on it.
Thanks to both
David
Thanks to both
David
Here's another method for this purpose.
Create a shortcut to run the copy and launch process.
Choose tab Program.
Set Command line to: "C:\Program Files\MyDir\MyOtherDir\MyP
Set Batch file to: <path and name of your batch file>
Mark Close when finished/terminated.
Reduce the batch file to:
@echo off
echo Copying current program file ...
copy "O:\MyDir\MyOtherDir\MyPro
Now, let the users run the shortcut.
/gustav