When you use the Microsoft Office XP Developer Packaging
Wizard to package an application, you may include and you may run a .bat file or an .exe file at the end of the package installation. By default, when you add a .bat file or an .exe file to the package, the Packaging Wizard sets the installation location to
$(AppPath). However, when you deploy the package on a computer that
runs the Microsoft Windows XP operating system, the .bat file or the .exe file does not run at the end
of the package installation.
Log on to a computer that runs the Windows XP operating
system.
Create a batch file by using a text editor such as Notepad.
To do this,
create a batch file that
copies the shortcut for the application that is deployed on your computer
from the current user profile to the All Users profile as follows. The shortcut is
available to other users who log on to your computer.
Click Start, and then
click Run.
In the Run dialog box, type
notepad in the Open box.
In the Notepad editor, type or paste the following
code:
MKDIR "<Installation Drive>:\Documents and Settings\All Users\Start Menu\Programs\Northwind"
:loop
if exist "<Installation Drive>:\Documents and Settings\administrator\Start Menu\Programs\Northwind" goto iNext
goto END
:iNext
copy "<Installation Drive>:\Documents and Settings\administrator\Start Menu\Programs\Northwind\" "<Installation Drive>:\Documents and Settings\All Users\Start Menu\Programs\Northwind\"
:END
Note Replace Installation Drive in this code with the
appropriate drive letter on you computer.
Save the file as CopyShortcut.bat.
When you deploy a distribution package on your computer, the
Setup creates a shortcut for the application on the Start menu. By default, the
shortcut is created in the profile of the current user. As a result, the
shortcut for the application is available only to the current user.
For example, if the
current user is user1, the shortcut is created in the Installation Drive:\Documents and Settings\user1\Start Menu\Programs\ folder.
If the batch file executes successfully at the end of the
package installation, the shortcut for the application is available to any user who logs on to the computer.
Create a distribution package for the Northwind database. Include the batch file in the distribution package for the Northwind database such
that the CopyShortcut.bat batch file runs at the end of the package installation. To do this, follow these steps:
Start Microsoft Access 2002.
Open the Northwind.mdb Northwind sample database.
On the Tools
menu, point to Macro on the Database window, and then click Visual Basic
Editor.
In the Microsoft Visual Basic Editor, click Packaging
Wizard on the
Add-Ins menu.
In the Identify Application and
Package window of the Packaging Wizard dialog box,
click Next.
In the Application Information window,
click Next.
In the Dependencies window, click
Add File.
In the Open dialog box, locate the
CopyShortcut.bat batch file that you created earlier in this article.
Click CopyShortcut.bat, and then click Open.
The CopyShortcut.bat batch file appears in the list
of files in the Packaging Wizard.
Click Next.
In
the Modify Installation Locations window of the
Packaging Wizard dialog box, the default value for
the Installation Location is set to
$(AppPath).
In the Access Runtime window, click
Next.
In the Access Runtime Properties
window, click Next.
In the Define Short Menu Shortcuts
window, click Next.
In the Run on Complete window, click
to select the Run this command when installation is finished
check box, and then click $(AppPath)\CopyShortcut.bat on
the list.
Click Finish.
In the Browse for Folder dialog box,
locate the folder where you want to store the distribution package, and
then click OK.
In the Package Complete window of the
Packaging Wizard, click Close.
Install the distribution package for the Northwind
database. To do this, follow these steps:
Start Microsoft Windows Explorer.
In Windows Explorer, locate the folder where the
distribution package for the Northwind database is created.
Double-click the setup.exe file.
Follow the steps that the wizard provides to deploy
the application.
Log on to your computer again by using the logon name of
another local Microsoft Windows user.
If you log on to your computer by using a logon name
that is different from the logon name that you used to install the package, the shortcut for
the application is not available in the Start menu. This situation occurs because the batch
file does not run at the end of the package installation. To verify this situation, examine the contents of the Installation Drive:\Documents and Settings\All Users\Start Menu\Programs\Northwind folder. If the CopyShortcut.bat batch file runs successfully at the end of the package deployment, this
folder should contain a shortcut for the Northwind database.