1

I'm trying to turn a .lnk file and its arguments into a programmatically executed process using ProcessStartInfo.

The .lnk file looks like this:

Target:

E:\Apps\RunAsDate\RunAsDate.exe 30\10\2017 00:00:00 "D:\MyTest\test.exe" 

Execute in:

"D:\MyTest"

I have a function in test.exe that displays the datetime so that I can check if it worked. For the .lnk file, it works perfectly.

I tried the following:

Dim nProc As New ProcessStartInfo
nProc.FileName = "E:\Apps\RunAsDate\RunAsDate.exe"
nProc.Arguments = "30\10\2017 00:00:00 ""D:\MyTest\test.exe"""
nProc.WorkingDirectory = "D:\MyTest"
nProc.UseShellExecute = True
Process.Start(nProc)

The file "D:\MyTest\test.exe" is being started, but the date arguments are lost, so I must be doing something wrong when passing the arguments.

What is the error here?

I'm running this as an admin.

tmighty
  • 10,734
  • 21
  • 104
  • 218

1 Answers1

0

Lars actually posted the correct answer in his comments but unfortunately deleted it again.

The arguments were typed correctly, but I ran the 64 bit version of RunAsDate against a 32 bit version of test.exe.

When I ran it against a 64 bit version of test.exe, it worked.

Thank you, Lars.

tmighty
  • 10,734
  • 21
  • 104
  • 218