0

I'm using the following code:

Dim start_info As New ProcessStartInfo("gci 'C:\Program Files\MyFolder\MyApp\' | Unblock-File") With {.UseShellExecute = False, .CreateNoWindow = True, .WindowStyle = ProcessWindowStyle.Hidden}
Dim pro As New Process With {.StartInfo = start_info}
pro.Start()
pro.WaitForExit()
MessageBox.Show("Unblock Files Exit Code: " & pro.ExitCode, "Exit " & "Code", MessageBoxButtons.OK, MessageBoxIcon.Information)

If I type the command (gci 'C:\Program Files\MyFolder\MyApp' | Unblock-File) in Win PowerShell all works well, but if I run the code I get "System.ComponentModel.Win32Exception: 'The system cannot find the file specified'" error.

Could anybody please help? Thank you.

1

1 Answer 1

0

Sorted by invoking 64 bit PowerShell

p.StartInfo.FileName = "C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.