Click here to Skip to main content
15,566,394 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to do gpg encryption through batch file
I get 'A 32 bit processes cannot access modules of a 64 bit process.' exception invoking Process.Start()

What I have tried:

Here is a sample of my code
Dim gpgPath As String = System.IO.Directory.GetDirectoryRoot(AppDomain.CurrentDomain.BaseDirectory) & "ABProreports\ME_ONBOARDING\Encryption\" & Format(Date.Now, "ddMMyyyy")
Dim mFileNo As Byte = 1

Dim myProcess As New System.Diagnostics.Process
myProcess.StartInfo.WorkingDirectory = System.IO.Directory.GetDirectoryRoot(AppDomain.CurrentDomain.BaseDirectory) & "APP_SERVER\ABPro\"
myProcess.StartInfo.FileName = (gpgPath & "\Encrypt_" & mFileNo & ".bat")
myProcess.StartInfo.UseShellExecute = False
myProcess.StartInfo.RedirectStandardOutput = True
Updated 18-Mar-19 3:42am
Richard MacCutchan 18-Mar-19 5:11am    
You need to build your application as a 64-bit process.

1 solution

If you want to run a batch file, you should do it like this:
myProcess.StartInfo.UseShellExecute = True
myProcess.StartInfo.RedirectStandardOutput = False
Note that you can't use RedirectStandardOutput this way !
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900