Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

PSHELL: Use 32-bit from 64-bit

Aug
1,917
68
Further to PSHELL switch for 32- or 64-bit;

Here is how I use PSHELL to communicate from 64-bit TCC to a 32-bit COM Object in 32-bit PowerShell.

First, start the 32-bit COM Object in 32-bit PowerShell;
Code:
@setlocal
@echo off
alias ps32=c:\windows\syswow64\windowspowershell\v1.0\powershell.exe
iff %@pid[powershell.exe] eq 0 then
  start /tabna %@alias[ps32] -noexit -command "$VFP = new-object -com VisualFoxPro.Application; $VFP | Get-Member"
endiff
set pspid=%@pid[powershell.exe]
iff %pspid eq 0 then
  echo PowerShell not active
  quit
endiff
endlocal
quit


Now, from 64-bit TCC, I can use the 64-bit PSHELL command to work with the 32-bit COM Object;
Code:
pshell /s "$vfp=[System.Runtime.InteropServices.Marshal]::GetActiveObject(“VisualFoxPro.Application”)"
pshell /s "$vfp | get-member"
pshell /s "$X = $vfp.docmd('amount=10')"
pshell /s "$X = $vfp.eval('amount')"
pshell /s "$X"
echo %@pshell[$X]

Joe
 
Back
Top