Batch file to run/open a desktop/quicklaunch shortcut... (1 Viewer)

dazza61

Registered User.
Local time
Today, 10:41
Joined
Feb 7, 2006
Messages
60
Hi guys,

Not sure if this can be done....

I've used a batch file to successfully open and close the current database....

However, I'm using the Granite AutoFE updater which launches from a shortcut...

So, I'm wondering if I can use the same batch file to open/run a shortcut...

The problem I have is with this line...

Print #1, "START /I " & """MSAccess.exe"" " & "C:\Documents and Settings\Administrator\Desktop\EMT.lnk"

This line always fails giving me a message that Windows can't find the file... (I guess it isn't an actual file because it's a shortcut to the file I want to open...)

Any pointers or code would be appreciated...

Darren
 

Scooterbug

Registered User.
Local time
Today, 05:41
Joined
Mar 27, 2009
Messages
853
You are telling access to open up a file with the extention of lnk..which is just a shortcut. Have it point to the actual exe that launches your program and you should be good to go.
 

dazza61

Registered User.
Local time
Today, 10:41
Joined
Feb 7, 2006
Messages
60
Thanks for the reply Scooter and I've used your logic and I think I'm getting closer....

Now I'm getting errors from the *exe...maybe it will help to show you what's in the shortcut:

Target: \\P12-abi\amtemt\InitCarlSimon\InitialiseAMTandEMT.exe /cmd /inifile:"\\P12-abi\amtemt\InitCarlSimon\EMTConfigLauncherOnly.ini"

Start In: \\P12-abi\AMTEMT\MasterEMT-FE

So my new batch line reads:

Print #1, "START /I " & "\\P12-abi\amtemt\InitCarlSimon\InitialiseAMTandEMT.exe /cmd /inifile:" & "\\P12-abi\amtemt\InitCarlSimon\EMTConfigLauncherOnly.ini"

But I'm still getting errors...(it's probably a syntax or "" in the wrong place)

Hope you can help

Darren
 

Scooterbug

Registered User.
Local time
Today, 05:41
Joined
Mar 27, 2009
Messages
853
Yup...it's a syntax error :)

I dunno what the START /I is...when I want to launch a program, I use:

Code:
Call Shell(sFileLocation, vbNormalFocus)

So for your case, sFileLocation would be:

Code:
sFileLocation = "\\P12abi\amtemt\InitCarlSimon\InitialiseAMTandEMT.exe /cmd /inifile:" & _ 
chr(34) & " \\P12-abi\amtemt\InitCarlSimon\EMTConfigLauncherOnly.ini  " & chr(34)

Basically, the exe file processes an ini file..and that ini file needs to have quotes around it. In vb, you need to tell access when to put quotes inside of quotes. That is what the chr(34) does.
 

dazza61

Registered User.
Local time
Today, 10:41
Joined
Feb 7, 2006
Messages
60
Sorry this is delayed - I like to try all angles before replying...

Well, I tried and tried and then some to use your answer to get it all to work but kept getting an error from the Tony Toews Auto FE Updater - so I kinda gave up......it's probably me because this Auto Updater is EXCELLENT...

In the end, frustration made me opt for a batch file for updating the front-end directly (I used some of Bob Larson's code and adapted it - many thanks Bob!)....It's strange that I couldn't get Bob's utility to work 2 years ago but it all works fine now.....though I did have to change the ping settings...

All I really wanted to achieve in this thread was a message to users that the front end needs updating, giving them the option to log off when convenient as when they are in the thick of things, the last thing they want is me booting them off when I update stuff...it's a shame I couldn't manage it with the Tony Toews one - but I guess I'm sorted now...

Once again many thanks for your time in replying Scooter

Darren
 

Users who are viewing this thread

Top Bottom