ODBC 连接信息从 Windows XP 导出到 Windows 7 的脚本?

发布于 2024-10-26 20:54:23 字数 49 浏览 5 评论 0原文

寻找从 WinXP 盒子导出到 Windows 7 盒子的 ODBC 连接信息脚本。

Looking for an ODBC connection information script that exports from a WinXP box to a Windows 7 box.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

心在旅行 2024-11-02 20:54:23

您可以从注册表导出 ODBC 设置并将其恢复到其他计算机上。不知道是否有脚本可以做到这一点,但应该很容易。请注意,因为越来越多的 Windows 计算机是 64 位版本,并且 32 位和 64 位应用程序的注册表位置有所不同。看一下:https://serverfault .com/questions/239002/registry-for-odbcad32-on-window-server-2003-64-bit/240112#240112

You can export ODBC setting from registry and restore it on other machine. Don't know if there is script that can do it, but it should be easy. Be aware, because more and more Windows machines are 64 bit versions and there registry location differs for 32 and 64 bit applications. Have a look at: https://serverfault.com/questions/239002/registry-for-odbcad32-on-window-server-2003-64-bit/240112#240112

爱的那么颓废 2024-11-02 20:54:23

注册表信息可能指向 Windows 7 x64 上不存在于同一位置的驱动程序 dll。例如,在 XP 上,驱动器可能位于“C:\Program Files\”,而在 Win7 x64 中,它位于“C:\Program Files (x86)”下 - 只是想向那些偶然发现这一点的人指出这一点。

vbscript 我放在一起:

objShell.Run "reg export " & Chr(34) & "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC" & Chr(34) & "SystemODBC64.reg",1,True
objShell.Run "reg export " & Chr(34) & "HKEY_CURRENT_USER\SOFTWARE\ODBC" & Chr(34) & "UserODBC64.reg",1,True

然后,更新脚本以合并到 32 位注册表中:

Set objOFile = objFSO.OpenTextFile("SystemODBC64.reg", ForReading, False, TristateTrue)
strSystemReg64Contents = objOFile.ReadAll

WScript.Echo "Formatting system ODBC to 32-bit"
strSystemReg64 = Replace(strSystemReg64Contents, "HKEY_LOCAL_MACHINE\Software","HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node",1,-1,1)

WScript.Echo "Creating System ODBC File"
objFSO.CreateTextFile("SystemODBC32.reg", True, True ).Write strSystemReg64

strUserReg64 = "UserODBC64.reg"
Set objOFile = objFSO.OpenTextFile(strUserReg64, ForReading, False, TristateTrue )
strUserReg64Contents = objOFile.ReadAll

WScript.Echo "Formatting user ODBC to 32-bit"
strUserReg64 = Replace(strUserReg64Contents, "HKEY_CURRENT_USER\Software","HKEY_CURRENT_USER\SOFTWARE\Wow6432Node",1,-1,1) 

WScript.Echo "Creating User ODBC File"
objFSO.CreateTextFile("UserODBC32.reg", True, True ).Write strUserReg64    

It's possible that the registry information may point to a driver dll that does not exist in the same place on Windows 7 x64. For instance, on XP the drive may be located in "C:\Program Files\" while in Win7 x64 it's located under "C:\Program Files (x86)" - just wanted to point that to those that stumble upon this.

vbscript I put together:

objShell.Run "reg export " & Chr(34) & "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC" & Chr(34) & "SystemODBC64.reg",1,True
objShell.Run "reg export " & Chr(34) & "HKEY_CURRENT_USER\SOFTWARE\ODBC" & Chr(34) & "UserODBC64.reg",1,True

And then, to update the script to merge into the 32-bit registry:

Set objOFile = objFSO.OpenTextFile("SystemODBC64.reg", ForReading, False, TristateTrue)
strSystemReg64Contents = objOFile.ReadAll

WScript.Echo "Formatting system ODBC to 32-bit"
strSystemReg64 = Replace(strSystemReg64Contents, "HKEY_LOCAL_MACHINE\Software","HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node",1,-1,1)

WScript.Echo "Creating System ODBC File"
objFSO.CreateTextFile("SystemODBC32.reg", True, True ).Write strSystemReg64

strUserReg64 = "UserODBC64.reg"
Set objOFile = objFSO.OpenTextFile(strUserReg64, ForReading, False, TristateTrue )
strUserReg64Contents = objOFile.ReadAll

WScript.Echo "Formatting user ODBC to 32-bit"
strUserReg64 = Replace(strUserReg64Contents, "HKEY_CURRENT_USER\Software","HKEY_CURRENT_USER\SOFTWARE\Wow6432Node",1,-1,1) 

WScript.Echo "Creating User ODBC File"
objFSO.CreateTextFile("UserODBC32.reg", True, True ).Write strUserReg64    
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文