2

The lines below are in a batch script I'm running,DW_ETL.bat

net use K: /DELETE /yes
net use K: \\SERVEUR-GPAO\Group_share /yes
start "C:\Program Files (x86)\Microsoft Office\root\Office16\MSACCESS.EXE" "K:\BI\Etl\DW_ETL.mdb"

As you can see in the picture below, the access binaries is installed in the right place e.g. C:\Program Files (x86)\Microsoft Office\root\Office16\MSACCESS.exe

enter image description here

Yet each time I'm running the script, I have the error below

enter image description here

It says Windows cannot open the file because it did not recognize the type of file

But when I open the mdb file from the Access, it can open the database.

Last thing, when I run the script from a different user on the same machine, the script can run perfectly.

Any ideas are more than welcomed.

Andy K
  • 392
  • any particular reason you are specifying the whole path to access? generally speaking, filetype associations exist so you can just say start /path/to/doc.ext and let the system figure out the rest. Are you working with multiple versions of access and mdb's that have to run in specific versions? – Frank Thomas Mar 09 '17 at 16:35

2 Answers2

3

The One problem is that start uses the first argument in double quotes as the window title.
See start /? and use a dummy empty pair to circumvent this.

net use K: /DELETE /yes
net use K: \\SERVEUR-GPAO\Group_share /yes
start "" "C:\Program Files (x86)\Microsoft Office\root\Office16\MSACCESS.EXE" "K:\BI\Etl\DW_ETL.mdb"
LotPings
  • 7,231
1

You need to re-associate .mdb files with the appropriate binary after you've remapped the drives.

https://superuser.com/a/29801/38001 is the best explaination of how to do it via commandline, I won't repeat the whole answer here.

In short

FTYPE MyCustomType=C:\Program Files\MyCustomProgram\MyProg.exe "%1"
ASSOC .custom=MyCustomType
  • you are probably right, but what would the network mapping have to do with the install-time association of the file type to msaccess.exe? – Frank Thomas Mar 09 '17 at 16:34
  • @FrankThomas that I don't know, I presume maybe the pre-existing path to the msaccess.exe was on the existing network drive that's removed. – djsmiley2kStaysInside Mar 09 '17 at 16:43