I have written some PowerShell
param (
[Parameter(Mandatory=$true)][string]$company,
[Parameter(Mandatory=$true)][string]$output
)
...
$objRecordset.Open("Select Col1, Col2, Col3 From $company_Table1.DBF", $objConnection,$adOpenStatic,$adLockOptimistic)
I am running it using
.\Test.ps1 -company A -output C:\test.txt
but for some reason the $company variable isn't being expanded even though it's in "quotes"?
Exception calling "Open" with "4" argument(s): "File '.dbf' does not exist."
At line:17 char:1
+ $objRecordset.Open("Select Col1, Col2, Col3 From $company_Table1. ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ComMethodTargetInvocation
When I hardcode it as A_Table1.dbf it works fine ...