Score:0

Run batch file to start specific program to open at specific record

pl flag

I need to be able to run a batch file that opens Access at a specific record. This I can do, but now I need to also run it on either 32 or 64 bit systems.

Our company uses a mix of systems.

This is what I have so far:

if EXIST "C:\Program Files\Microsoft Office\root\Office16\MSACCESS.EXE" 

GOTO x64
ELSE GOTO x32

:x64 
start "" "C:\Program Files\Microsoft Office\root\Office16\MSACCESS.EXE" "K:\R&D Dept\Development Lab\R&D Test Request System (For testing and training)\DataBase\R&D Project Requests DB.accdb" /x mcrEmail /cmd 1912

:x32 
start "" "C:\Program Files (x86)\Microsoft Office\root\Office16\MSACCESS.EXE" "K:\R&D Dept\Development Lab\R&D Test Request System (For testing and training)\DataBase\R&D Project Requests DB.accdb" /x mcrEmail /cmd 1912

pause

I tried running this is the trial version of CMDebug, when I hit the :x64 line my program runs but then it also hits the :x32 line.

When trying to run this just as a batch file by clicking on it nothing happens. I'm running Access 2016 on a 64 bit system, Windows 10. My office apps are also 64 bit.

Not sure what I'm going wrong?

Score:0
se flag

try this:

@echo off
if EXIST "C:\Program Files\Microsoft Office\root\Office16\MSACCESS.EXE" GOTO x64
if EXIST "C:\Program Files (x86)\Microsoft Office\root\Office16\MSACCESS.EXE" GOTO x32

echo No MSACCESS.EXE found - press key to exit
pause > nul
exit

:x32 
start "C:\Program Files (x86)\Microsoft Office\root\Office16\MSACCESS.EXE" "K:\R&D Dept\Development Lab\R&D Test Request System (For testing and training)\DataBase\R&D Project Requests DB.accdb" /x mcrEmail /cmd 1912
GOTO finished

:x64 
start "C:\Program Files\Microsoft Office\root\Office16\MSACCESS.EXE" "K:\R&D Dept\Development Lab\R&D Test Request System (For testing and training)\DataBase\R&D Project Requests DB.accdb" /x mcrEmail /cmd 1912
GOTO finished

:finished
echo normal script end
pause > nul
exit

Regarding your access parameters i did not change anything as i do not know the details.

Please leave some feedback if it was helpful, or if you need some improvements. If it helped mark it as answered.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.