Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: ObjClrOption AppBase Loadfrom SQLite Assembly DLL CLR Powershell
ObjectClrOption("use", "System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089") cn = ObjectClrNew("System.Data.SQLite.SQLiteConnection") cn.ConnectionString = "Data Source=E:\RA\SQLITE\SMS.SQLITE" cn.Open() cm = ObjectClrNew("System.Data.SQLite.SQLiteCommand") cSQL = "SELECT SMS, Carrier FROM Carriers" cm.Connection = cn cm.CommandText = cSQL dr = cm.ExecuteReader()
ObjectClrOption("AppBase", "C:\Powershell")The second rule is that for what I hope are obvious reasons WinBath does not automagically load assemblies into the AppDomain of your script. The only exception is the 'mscorlib' assembly which the CLR automatically loads when it is loaded into a process. You use the 'use' option to load assemblies into your WinBatch script AppDomain so you need the following before you can make use of your assembly's classes.
ObjectClrOption("use","System.Data.SQLite")Together these statements are equivalent to your Powershell "[System.Reflection.Assembly]::LoadFrom("C:\Powershell\System.Data.SQLite.dll")" line.
The SQLite assembly works well in WinBatch. In fact, we use it as part of the CLR subsystem regression test.
Article ID: W17805
Filename: Rules for Using Appbase.txt
File Created: 2014:01:06:10:00:26
Last Updated: 2014:01:06:10:00:26