Tags I am associated with:

Tags I am associated with: Microsoft SQL Server, IBM Cognos BI and Planning, Deltek Costpoint, Deltek Time & Expense, Magento, Intuit QuickBooks, Visual Basic 6, SSIS, Oracle, SQL development, data warehouse, reporting, eCommerce, accounting, finance, ETL

Wednesday, July 20, 2011

Windows 7 batch script behavior difference vs. XP

One of my clients is in midst of migrating a few reporting applications over from XP to Windows 7 and called me to assist in looking at an issue where they could not register some dll components.

I took a look at the Windows batch file and it contained lines like:
copy xxx.dll "%WINDIR%\System32"
regsvr32 xxx.dll


When I launched the script, it complained about access denied, so I right-clicked the script and ran it as administrator. But running as administrator, it complained it cannot find the xxx.dll.
That's when I noticed the execution directory became c:\windows\system32 when I executed the script as administrator, even thought the script was located in another drive letter and path.

The solution was to update the batch file as follows:
copy <path>\xxx.dll "%WINDIR%\System32"
regsvr32 xxx.dll


and then run it as administrator.

No comments:

Post a Comment