Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

bat file to start access db then close cmd window

Status
Not open for further replies.

anorakgirl

Programmer
Jun 5, 2001
103
GB
I am stuck trying to write a bat file.

the command i need to run is this:

Code:
"C:\Program Files\Microsoft Office\Office\MSACCESS.EXE" "%userprofile%\Desktop\myDb.mde" /wrkgrp \\MyServer\myWorkGroup.mdw

This works fine on its own in a bat file. But, the cmd window stays open until the access database is closed, which is bothering my users.

I read somewhere that running a command like this:
start /d "MyCommand" would then close the window, but I can't get this to work I think because of all the quotes already in my command.

For example, if I do

Code:
start /d "C:\Program Files\Microsoft Office\Office\MSACCESS.EXE" "%userprofile%\Desktop\mt_ops.mde" /wrkgrp \\myServer\myWorkGroup.mdw

I get "invalid switch - /wrkgrp"

And I can't see how to put quotes around it all cos of the quotes already there. It really needs to work on XP and 2000 as well...

So, any suggestions gratefully appreciated.
Thanks!

~ ~
 
The following should see you right

Code:
C:\"Program Files"\"Microsoft Office"\Office\MSACCESS.EXE" %userprofile%\Desktop\myDb.mde /wrkgrp \\MyServer\myWorkGroup.mdw
Exit

If not try

Code:
start /d C:\"Program Files"\"Microsoft Office"\Office\"MSACCESS.EXE %userprofile%\Desktop\mt_ops.mde /wrkgrp" \\myServer\myWorkGroup.mdw
Exit

Greg Palmer
Free Software for Adminstrators
 
thanks for the suggestions - the one that worked in the end was:


start /d "" "C:\Program Files\Microsoft Office\Office\MSACCESS.EXE" "%userprofile%\Desktop\myDb.mde" /wrkgrp \\myServer\myWorkGroup.mdw

note the empty quotes after the /d - this is apparently because the start command expects the first quoted item to be the name of the window to run the cmd in, and the second item to be the command. or something like that, it works anyway!

cheers

~ ~
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top