Attempting to convert SWF to standalone EXE in AIR with FlashDevelop - actionscript-3

This problem has been bugging me for a while now, I'm trying to make a standalone EXE from a SWF of a game I'm making, but I've had tons of trouble during the way. I want it standalone, meaning no installer, I want the user to be able to open the EXE and start playing automatically. I'm using FlashDevelop's AIR AS3 Projector Project and have gotten almost all the kinks out, but there's still a snag I'm hitting in the end. I've been able to build the EXE, but upon launch attempt I'm hit with an error that reads: "This application requires a version of Adobe AIR which cannot be found." I've ensured both my AIR project and game project are using AIR version 17, but it's still not working.
I'll provide the code for the bats below and hopefully someone can figure this out.
Packager.bat
#echo off
:: Set working dir
cd %~dp0 & cd ..
if not exist %CERT_FILE% goto certificate
:: AIR output
if not exist %AIR_PATH% md %AIR_PATH%
set OUTPUT=%AIR_PATH%\%AIR_NAME%%AIR_TARGET%.air
:: Package
echo.
echo Packaging %AIR_NAME%%AIR_TARGET%.air using certificate %CERT_FILE%...
adt -package -keystore bat\TheLabyrinth.p12 -storetype pkcs12 -target bundle The_Labyrinth application.xml -C bin TheLabyrinth.swf TheLabyrinthGame.swf lib\backgrounds\cobblestone.png lib\backgrounds\frameBackground.png lib\backgrounds\fullscreenCobble.png lib\backgrounds\parchment.png lib\backgrounds\parchmentFrameBackground.png lib\spritesheet.png
call adt -package %OPTIONS% %SIGNING_OPTIONS% %OUTPUT% %APP_XML% %FILE_OR_DIR%
if errorlevel 1 goto failed
goto end
:certificate
echo.
echo Certificate not found: %CERT_FILE%
echo.
echo Troubleshooting:
echo - generate a default certificate using 'bat\CreateCertificate.bat'
echo.
if %PAUSE_ERRORS%==1 pause
exit
:failed
echo AIR setup creation FAILED.
echo.
echo Troubleshooting:
echo - verify AIR SDK target version in %APP_XML%
echo.
if %PAUSE_ERRORS%==1 pause
exit
:end
echo.
Application.xml
<?xml version="1.0" encoding="utf-8" ?>
<application xmlns="http://ns.adobe.com/air/application/17.0">
<id>TheLabyrinth</id>
<versionNumber>1.0</versionNumber>
<filename>TheLabyrinth</filename>
<name>The Labyrinth</name>
<description></description>
<copyright></copyright>
<initialWindow>
<title>The Labyrinth</title>
<content>TheLabyrinth.swf</content>
<systemChrome>standard</systemChrome>
<transparent>false</transparent>
<visible>true</visible>
<minimizable>true</minimizable>
<maximizable>true</maximizable>
<resizable>true</resizable>
</initialWindow>
<!--
More options:
http://livedocs.adobe.com/flex/3/html/File_formats_1.html#1043413
-->
</application>
Thanks for any help regarding this, I've searched far and wide for an answer and I've yet to come across a fix.

Okay, I forgot about this question but I'm coming back to answer it in case anyone else stumbles upon it. Whenever using FlashDevelop with the intent of creating a standalone executable, I choose the AIR AS3 Projector when creating a new project. This will already contain the batch files you're going to need to change using my files below (I'll also show any unique changes you need to make). From there here are the settings for the batch files that I copy over from a previous project that works.
First I'll show the application.xml since that has a few things we want to check out beforehand. The settings will automatically populate in this xml when you launch your program in either Debug or Release mode. This specific example is from a game titled Charlene for my girlfriend:
<?xml version="1.0" encoding="utf-8"?>
<application xmlns="http://ns.adobe.com/air/application/21.0">
<id>Charlene</id>
<versionNumber>1.0</versionNumber>
<filename>Charlene</filename>
<name>Charlene</name>
<initialWindow>
<title>Charlene</title>
<content>Charlene.swf</content>
<systemChrome>standard</systemChrome>
<transparent>false</transparent>
<visible>true</visible>
<minimizable>true</minimizable>
<maximizable>false</maximizable>
<resizable>false</resizable>
<x>0</x>
<y>0</y>
<minSize>800 800</minSize>
</initialWindow>
<!--
More options:
http://livedocs.adobe.com/flex/3/html/File_formats_1.html#1043413
-->
<supportedProfiles>extendedDesktop</supportedProfiles>
<android>
<manifestAdditions><![CDATA[<manifest android:installLocation="auto" xmlns:android="http://schemas.android.com/apk/res/android" />]]></manifestAdditions>
</android>
</application>
There are two things to note here: the application xmlns version MUST be the same version as the AIR version you're using (this can be viewed by clicking Project, and then Properties). If this is not the same version, simply change either the xml or the version in the Properties otherwise your program won't compile.
The next thing to note is the supportedProfiles. The extendedDesktop setting is required if you want the keyboard to work while your program is in fullscreen.
Now we're going to look at CreateCertificate.bat. You need to run this batch file before any others, as the compiler needs a certificate to package your program. This will create a unique key for your program with the name "YourProgramTitle.p12":
#echo off
:: Set working dir
cd %~dp0 & cd ..
set PAUSE_ERRORS=1
call bat\SetupSDK.bat
call bat\SetupApp.bat
:: Generate
echo.
echo Generating a self-signed certificate...
call adt -certificate -cn %CERT_NAME% 2048-RSA %CERT_FILE% %CERT_PASS%
if errorlevel 1 goto failed
:succeed
echo.
echo Certificate created: %CERT_FILE% with password "%CERT_PASS%"
echo.
if "%CERT_PASS%" == "fd" echo Note: You did not change the default password
echo.
echo HINTS:
echo - you only need to generate this certificate once,
echo - wait a minute before using this certificate to package your AIR application.
echo.
goto end
:failed
echo.
echo Certificate creation FAILED.
echo.
:end
pause
No special settings here, moving on to the PackageApp.bat. This is another batch that doesn't require specific changing, the settings here should work for compiling your project:
#echo off
:: Set working dir
cd %~dp0 & cd ..
set PAUSE_ERRORS=1
call bat\SetupSDK.bat
call bat\SetupApp.bat
set AIR_TARGET=air/Setup.exe
::set AIR_TARGET=-captive-runtime
set OPTIONS=-tsa none
call bat\Packager.bat
pause
Next up is the big one, Packager.bat. Again, no special settings here, this batch file should be good to copy over and not change:
#echo off
:: Set working dir
cd %~dp0 & cd ..
if not exist %CERT_FILE% goto certificate
:: AIR output
if not exist %AIR_PATH% md %AIR_PATH%
set OUTPUT=-target bundle %AIR_NAME%
:: Package
echo.
echo Packaging %AIR_NAME%%AIR_TARGET%.air using certificate %CERT_FILE%...
call adt -package %OPTIONS% %SIGNING_OPTIONS% %OUTPUT% %APP_XML% %FILE_OR_DIR%
if errorlevel 1 goto failed
goto end
:certificate
echo.
echo Certificate not found: %CERT_FILE%
echo.
echo Troubleshooting:
echo - generate a default certificate using 'bat\CreateCertificate.bat'
echo.
if %PAUSE_ERRORS%==1 pause
exit
:failed
echo AIR setup creation FAILED.
echo.
echo Troubleshooting:
echo - verify AIR SDK target version in %APP_XML%
echo.
if %PAUSE_ERRORS%==1 pause
exit
:end
echo.
Next up is RunApp.bat. There's not much here but I'll include it anyway:
#echo off
:: Set working dir
cd %~dp0 & cd ..
set PAUSE_ERRORS=1
call bat\SetupSDK.bat
call bat\SetupApp.bat
echo.
echo Starting AIR Debug Launcher...
echo.
adl "%APP_XML%" "%APP_DIR%"
if errorlevel 1 goto error
goto end
:error
pause
:end
You can actually change the echo Starting AIR Debug Launcher... line if you want the cmd to show a different message before the debugger launches.
We're gonna look at the SetupApp.bat. This has some parameters you're going to have to change to fit your program:
:: Set working dir
cd %~dp0 & cd ..
:user_configuration
:: About AIR application packaging
:: http://livedocs.adobe.com/flex/3/html/help.html?content=CommandLineTools_5.html#1035959
:: http://livedocs.adobe.com/flex/3/html/distributing_apps_4.html#1037515
:: NOTICE: all paths are relative to project root
:: Your certificate information
set CERT_NAME="Charlene"
set CERT_PASS=fd
set CERT_FILE="bat\Charlene.p12"
set SIGNING_OPTIONS=-storetype pkcs12 -keystore %CERT_FILE% -storepass %CERT_PASS%
:: Application descriptor
set APP_XML=application.xml
:: Files to package
set APP_DIR=bin
set FILE_OR_DIR=-C %APP_DIR% .
:: Your application ID (must match <id> of Application descriptor) and remove spaces
for /f "tokens=3 delims=<>" %%a in ('findstr /R /C:"^[ ]*<id>" %APP_XML%') do set APP_ID=%%a
set APP_ID=%APP_ID: =%
:: Output
set AIR_PATH=air
set AIR_NAME=Charlene
:validation
findstr /C:"<id>%APP_ID%</id>" "%APP_XML%" > NUL
if errorlevel 1 goto badid
goto end
:badid
echo.
echo ERROR:
echo Application ID in 'bat\SetupApp.bat' (APP_ID)
echo does NOT match Application descriptor '%APP_XML%' (id)
echo.
if %PAUSE_ERRORS%==1 pause
exit
:end
Here, the set CERT_NAME="Charlene" line should have the string name that's equal to the name parameter in the application.xml. The set CERT_FILE="bat\Charlene.p12" file name should be the same name your CreateCertification.bat created when you ran it (run it now if you haven't). set AIR_NAME=Charlene should again have the same name as the CERT_NAME (assuming you want your finished project to have the same name as your debugged one).
Lastly we're going to look at the SetupSDK.bat. This one has one line you're going to have to change:
:: Set working dir
cd %~dp0 & cd ..
:user_configuration
:: Static path to Flex SDK
set FLEX_SDK=C:\Users\Alec\AppData\Local\FlashDevelop\Apps\flexairsdk\4.6.0+21.0.0
:: Use FD supplied SDK path if executed from FD
if exist "%FD_CUR_SDK%" set FLEX_SDK=%FD_CUR_SDK%
:validation
if not exist "%FLEX_SDK%\bin" goto flexsdk
goto succeed
:flexsdk
echo.
echo ERROR: incorrect path to Flex SDK in 'bat\SetupSDK.bat'
echo.
echo Looking for: %FLEX_SDK%\bin
echo.
if %PAUSE_ERRORS%==1 pause
exit
:succeed
set PATH=%FLEX_SDK%\bin;%PATH%
set FLEX_SDK should have the path to your Flex+AIR SDK. If you need to know the path, click the Project tab, then Properties, navigate to the SDK tab, click Manage, click the Installed Flex SDKs parameter, click the ellipses square on the right side of the InstalledSDK[] Array, make sure you've selected the most current version of the SDK on the left Members side (or the one that has the same version as your application.xml file), expand the window and you should see the path under the Location field.
Okay, it's been a long road. Test your project to make sure your local swf is updated, then run the PackageApp.bat. If everything was set up properly there should be no errors and after a few second the cmd will say "Press any key to continue" and a new folder with the name of your project should appear in your project's directory. This folder should contain another folder called Adobe AIR, a lib folder, a META-INF folder, an exe with your project's name, an swf with your project's name, and a mimetype file. You should be able to run the exe with no issue. And there you have it! Hopefully this works for anyone else with this problem.
Just a quick note: I noticed when packaging relatively large projects, sometimes the batch files don't compile a full project. It can take many attempts before it compiles fully, but I found a cheat. It requires an already existing, fully compiled project. All you need to do is copy over your project's swf (normally housed in your bin folder) over to the packaged project's folder. You may also need to copy over other files if you've changed them, such as the application.xml (the compiled file is located in the META-INF\AIR directory), or the lib folder if you import anything during run-time. This lets you bypass recompiling!

Related

MySQL silent install fails

I am trying to install mysql-installer-community-5.6.20.0.msi through batch file.
In the first step I try to unpack the manifest which gives me access to installer console. Passive install works alright however, if I try to install it quietly the batch file exits without unpacking the manifest.
Here is the 1st step batch file code:
#echo off
color 0a
cls
echo ==========================================
echo MySQL Server - Installation - v.11/02/2015
echo ==========================================
echo .
echo .
rem ------------------------------------------------
echo Installing MySQL (This may take a few minutes)
msiexec /i mysql-installer-community-5.6.20.0.msi /q /norestart /L*v "mysql-installer-community-5.6.20.0.msi.log"
echo Done.
Do anyone have a way around this error?
/q may be raising an error since it's the the first character of user interface level options (/qn for example). Try using the full quiet option, /quiet
Finally found the solution, found out that the log file was showing 1729 and the next line showed configuration failed message.
Searching for error code 1729 in MySQL error codes. I found
Error: 1729 SQLSTATE: HY000 (ER_NO_SUCH_PARTITION)
Message: partition '%s' doesn't exist
Figured it may be as cmd was launching from System32. Adding %~dp0 (current directory) solved the issue.
I hope this may help others.

Error while building tk8.4.19-src

While building tk8.4.19-src by buildall.vc batch file for windows. It is showing following error:
rules.vc(449) : fatal error U1023: syntax error in expression
Stop.
I have no idea about solution. Please help.
Edit: buildall.vc file which is calling nmake
#echo off
:: This is an example batchfile for building everything. Please :: edit this (or make your own) for your needs and wants using :: the instructions for calling makefile.vc found in makefile.vc :: :: RCS: #(#) $Id: buildall.vc.bat,v 1.4 2002/11/04 07:49:43 davygrvy Exp $
echo Sit back and have a cup of coffee while this grinds through ;) echo You asked for *everything*, remember? echo.
title Building Tk, please wait...
if "%MSVCDir%" == "" call "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat" ::if "%MSVCDir%" == "" call "C:\Program Files (x86)\Microsoft Visual Studio
9.0\VC\bin\vcvars32.bat"
set INSTALLDIR =C:\Program Files\Tcl
:: Where is the Tcl source directory? set TCLDIR= "C:\Tcl\include\tcl8.5" ::set TCLDIR=..\..\tcl8.4 pause :: Build the normal stuff along with the help file. :: nmake -nologo -f makefile.vc release winhelp OPTS=none if errorlevel 1 goto error
:: Build the static core, dlls and shell. :: nmake -nologo -f makefile.vc release OPTS=static if errorlevel 1 goto error pause :: Build the special static libraries that use the dynamic runtime. :: nmake -nologo -f makefile.vc core OPTS=static,msvcrt if errorlevel 1 goto error
:: Build the core and shell for thread support. :: nmake -nologo -f makefile.vc release OPTS=threads if errorlevel 1 goto error
:: Build a static, thread support core library (no shell). :: nmake
-nologo -f makefile.vc core OPTS=static,threads if errorlevel 1 goto error
:: Build the special static libraries the use the dynamic runtime, :: but now with thread support. :: nmake -nologo -f makefile.vc core OPTS=static,msvcrt,threads if errorlevel 1 goto error
goto end
:error echo *** BOOM! ***
:end title Building Tk, please wait...DONE! echo DONE! pause
I am using The C++ compiler identification is MSVC 15.0.30729.1
C++ compiler using: Visual Studio 9 2008 Win32
I encountered the same problem while compiling tk 8.6.3
rules.vc(514) : fatal error U1023: syntax error in expression
which is the line
!if exist("$(_TCLDIR)\include\tcl.h")
I had set the TCLDIR macro using quotes around the path.
Removing the quotes made the problem go away for me.
If we look at line 449 of rules.vc in the Tcl 8.4.19 distribution, it looks unremarkable; there are many other lines before it that seem to me to be syntactically similar.
If we look at line 449 of rules.vc in the Tk 8.4.19 distribution, it also looks unremarkable to me; there's nothing there that screams out “I'm wrong” in a way that other preceding lines wouldn't also do.
If we look at the (mangled) code that you added, it's appears to be referring to Tcl 8.5, or maybe Tk 8.5. The equivalent lines for Tcl 8.5.14 and Tk 8.5.14 are also unremarkable. (These versions were selected because they were the current ones at the point where you did your question.) You're strongly recommended to not mix Tcl and Tk of different versions when building Tk (but Tk might load into Tcl of a later version after being built; this is more likely with Tk 8.5 and Tcl 8.6, where at least some effort into checking that this works occasionally).
In short, I can't figure out why it might be complaining about that line in particular.
To cap it all, you're the only person who appears to have this problem. There other people who do build with those files on Windows (and who are quick to complain when we make a real mistake in them) so we've got a fairly high level of confidence that it's not a problem in any version of rules.vc that you appear to have report. This means that whatever is going wrong, it's highly likely to be a problem caused by you doing something strange. Alas, there's too many strange things in this world, and the particular spoor of this one is unfamiliar to me.
Had the same problem.
Disappeared when I made sure that directories tcl8.6.9 and tk8.6.9 are at a position with NO BLANKS in path (NOT in C:\Program Files...) AND when setting environment vars TCLDIR, TCL_LIBRARY and TK_LIBRARY , also NO BLANKS contained AND NO " around paths (
set TCLDIR=C:\tcl8.6.9
REM Not!!! : set TCLDIR="C:\tcl8.6.9"
set TCL_LIBRARY=C:\tcl8.6.9\library
set TK_LIBRARY=C:\tk8.6.9\library
). Now compiling works.

How to get CruiseControl.NET working with Mercurial: "Source control failure (GetModifications)"

I'm trying to set up CruiseControl.NET 1.5.7256.1 for automatic builds. My project is stored in Mercurial, and I'm using the following ccnet.config:
<cruisecontrol xmlns:cb="urn:ccnet.config.builder">
<project name="Slider" webURL="http://localhost/ccnet">
<triggers>
<intervalTrigger seconds="3600" />
</triggers>
<sourcecontrol type="hg" autoGetSource="true">
<executable>C:\Python26\Scripts\hg.bat</executable>
<repo>c:\repos\slider</repo>
<workingDirectory>c:\ccnet\slider</workingDirectory>
</sourcecontrol>
<tasks>
<msbuild>
<executable>C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe</executable>
<workingDirectory>c:\ccnet\slider</workingDirectory>
<projectFile>Slider.sln</projectFile>
<buildArgs>/noconsolelogger /p:Configuration=Debug /v:diag</buildArgs>
<targets>Slider</targets>
<timeout>900</timeout>
<logger>C:\Program Files (x86)\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll</logger>
</msbuild>
</tasks>
</project>
</cruisecontrol>
But when I force a build, I get this error:
[Slider:WARN] Source control failure (GetModifications): Source control operation failed: < was unexpected at this time.
. Process command: C:\Python26\Scripts\hg.bat log -r 0:123 --template <modification><node>{node|short}</node><author>{author|user}</author><date>{date|rfc822date}</date><desc>{desc|escape}</desc><rev>{rev}</rev><email>{author|email|obfuscate}</email><files>{files}</files></modification> --noninteractive
[Slider:INFO] Integration complete: Exception - 12/2/2010 1:19:08 PM
The error is presumably caused by the unquoted angle brackets in the --template parameter, but how can I make CC.NET put quotes around that parameter?
===============
Here's hg.bat:
#echo off
rem Windows Driver script for Mercurial
setlocal
set HG=%~f0
rem Use a full path to Python (relative to this script) as the standard Python
rem install does not put python.exe on the PATH...
rem %~dp0 is the directory of this script
%~dp0..\python "%~dp0hg" %*
endlocal
I'm successfully using CruiseControl.NET 1.5.7256.1 with Mercurial installed from this msi, using full path of hg.exe as the executable value.
In project\core\sourcecontrol\Mercurial\Mercurial.cs the template is used like this:
buffer.AddArgument("--template", HistoryTemplate)
and will be formatted for the command line like this:
string.Format("{0}{1}{2}", arg, separator, StringUtil.AutoDoubleQuoteString(value))
where the separator is " ", and AutoDoubleQuoteString will quote the template, so this can't be the cause of the error.
UPDATE 1
Actually, AutoDoubleQuoteString should quote the template, but in the current version doesn't do it. Also, even if the build succeeds when using hg.exe, running the actual command line in a command prompt returns the same error.
UPDATE 2
CruiseControl.NET 1.6.7981.1 was just released (see release notes), and since the template is now passed as a file, it works just fine (at least on my PC).

Integrating Hudson with UCM Clearcase on windows machine

I've installed Hudson on my windows machine and trying to integrate it with UCM Clearcase (the repository we are using).
There are no help docs available on Hudson wiki to explain how to do that.
I select New Job --> Project Name
I give as Test --> select Build a free style software project --> click Ok
--> This leads me to Configure Project screen
--> Under Source Code management I select UCM Clearcase
--> I give a dynamic view name I've already created and the name of the integration stream (in stream selector)
--> Under Advanced options I select "Use UCM dynamic view" and give view root as M:\ and in "Windows dynamic view storage directory" I give \\Hostname\CC_Views\MyTestView.vws.
Now I run the project to check if the fetch in working properly or not and I get this error:
[advcm3_LAC_FN38_Test] $ cleartool pwv -root M:\advcm3_LAC_FN38_Test
[workspace] $ cleartool startview advcm3_LAC_FN38_Test
[advcm3_LAC_FN38_Test] $ cleartool setcs -tag advcm3_LAC_FN38_Test -stream
cleartool: Warning: Config spec OK, but unable to tell view server to load.
cleartool: Warning: View server should be restarted.
cleartool: Error: Unable to change configuration specification: Permission denied.
FATAL: UCM ClearCase failed. exit code=1
java.io.IOException: cleartool did not return the expected exit code. Command line="setcs -tag advcm3_LAC_FN38_Test -stream", actual exit code=1
at hudson.plugins.clearcase.HudsonClearToolLauncher.run(HudsonClearToolLauncher.java:107)
at hudson.plugins.clearcase.HudsonClearToolLauncher.run(HudsonClearToolLauncher.java:70)
at hudson.plugins.clearcase.ClearToolDynamicUCM.setcs(ClearToolDynamicUCM.java:81)
at hudson.plugins.clearcase.ClearToolDynamicUCM.syncronizeViewWithStream(ClearToolDynamicUCM.java:66)
at hudson.plugins.clearcase.action.UcmDynamicCheckoutAction.checkout(UcmDynamicCheckoutAction.java:99)
at hudson.plugins.clearcase.AbstractClearCaseScm.checkout(AbstractClearCaseScm.java:398)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1038)
at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:479)
at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:411)
at hudson.model.Run.run(Run.java:1257)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:129)
Nothing has been fetched into C:\Hudson\jobs\Test\workspace.
Can someone please guide me in this?
Thanks,
Umang
This is usually symptomatic of an ACL issue.
You need to:
make sure what user are actually running the Hudson Jobs (and with what CLEARCASE_PRIMARY_GROUP environment value)
check the view protection
cd m:\advcm3_LAC_FN38_Test
cleartool lsview -l -full -pro -cview
If the user differ, you need to reprotect the view
fix_prot -force -r -chown rightUser -chgrp rightGroup -chmod 775 \\Hostname\CC_Views\MyTestView.vws.
fix_prot -force -root -chown rightUser -chgrp rightGroup \\Hostname\CC_Views\MyTestView.vws.
fix_prot is in c:/Program Files/rational/clearcase/etc/utils for CC7.0 or less, or c:/Program Files/IBM/RationalSDLC/clearcase/etc/utils for CC7.1 or more.
Note: it is strange that a view called advcm3_LAC_FN38_Test has an associated view storage called MyTestView.vws.
I would have rather expected a \\Hostname\CC_Views\advcm3_LAC_FN38_Test.vws.

Command line to change path to .mdb file for MS Access ODBC System DSN?

What odbcconf.exe command line can I use to change the path to the MS Access .mdb file for an already existing System DSN?
You would have to do it by changing the registry. Something along the lines of this example taken from the net that I have used before
rem -----Author: Jim Michaels
rem -----copy the drivers where all good little ODBC drivers go
if errorlevel 1 goto bye
copy myodbcd.dll C:\WINDOWS\SYSTEM
if errorlevel 1 goto bye
rem ----create a .REG file to make registry entries
echo REGEDIT4>myodbc.reg
echo.>>myodbc.reg
echo [HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\MySQL]>>myodbc.reg
echo "APILevel"="2">>myodbc.reg
echo "ConnectFunctions"="YYN">>myodbc.reg
echo "Driver"="C:\\WINDOWS\\SYSTEM\\myodbc.dll">>myodbc.reg
echo "DriverODBCVer"="02.50">>myodbc.reg
echo "FileExtns"="*.txt">>myodbc.reg
echo "FileUsage"="0">>myodbc.reg
echo "Setup"="C:\\WINDOWS\\SYSTEM\\myodbc.dll">>myodbc.reg
echo "SQLLevel"="1">>myodbc.reg
echo.>>myodbc.reg
echo [HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers]>>myodbc.reg
echo "MySQL"="Installed">>myodbc.reg
echo.>>myodbc.reg
rem -----install the registry entries by executing the .REG file
start /wait myodbc.reg
rem ----clean up after we are done installing
del myodbc.reg
:bye
If you look at your existing DSN config in the registry then you will get an idea of how to modify the code to suit your situation
To answer the question as asked, here is a solution using odbcconf.exe instead of going straight to the registry:
odbcconf.exe configsysdsn ^
"Microsoft Access Driver (*.mdb, *.accdb)" ^
"DSN=OurConnectionName;DBQ=X:\Path\to\OurMsAccessDB.mdb"
Two items of note which had me tripped up for a while:
make sure you use 64bit odbcconf.exe when on a 64bit system, see https://stackoverflow.com/questions/6721702/windows-7-64-bit-odbc-drivers-for-ms-access-missing.
use DBQ= and not Database= for the mdb path. When using the latter everything appears to work, however the connection link is named but not actually defined in the ODBC Administrator.