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

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,391
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
djsmiley2kStaysInside
  • 6,943
  • 2
  • 36
  • 48