1

I am writing a launcher program, and when I go to start the process I get the "The directory name is invalid" error. Here is the code that is launching the process:

Const DEBUG_ROOT = _ 
"Z:\Kiosk_JC\KioskSignIn.root\KioskSignIn\KioskSignIn\KioskSignIn\bin\Debug"

Dim oKiosk As New System.Diagnostics.Process
oKiosk.StartInfo.UserName = oEnc.Decrypt(Username)
oKiosk.StartInfo.Password = oEnc.DecryptSecure(Password)
oKiosk.StartInfo.Domain = oEnc.Decrypt(Domain)
''// The AddBS function appends a '\' to the passed string if it is not present
oKiosk.StartInfo.WorkingDirectory = AddBS(DEBUG_ROOT)
oKiosk.StartInfo.FileName = "KioskSignIn.exe"
oKiosk.StartInfo.UseShellExecute = False
Dim proc As Process = Nothing
proc = System.Diagnostics.Process.Start(oKiosk.StartInfo)

I saw on another question here that I needed to set the WorkingDirectory (before I started searching I was getting the error). Even though I have this property set, I am still getting the error. Any thoughts?

More info

I should also note that my Z:\ is a on my network. I have a function that resolves a path to UNC. When I ran this function on DEBUG_ROOT, I get the same error.

I tried moving the application to c:\kiosk. Same result. I am logged in as the user I am impersonating, so I have access to all shares and files.

Here is the link, for some reason the URL formating wants to consume all the text after the link is designated:

Referred Post

Community
  • 1
  • 1
Anders
  • 12,088
  • 34
  • 98
  • 146
  • Does it run if you put something simple for working directory that you know this user has access to on the local machine? – JP Alioto May 07 '09 at 16:40
  • Okay, how about this, hard code the user, password and domain (or at least check the properties at runtime) to make sure that it's not your encryption routine that's a problem. – JP Alioto May 07 '09 at 17:16

3 Answers3

2

Mapped drives are per-user. You are likely starting the process with a different user.

John Saunders
  • 160,644
  • 26
  • 247
  • 397
0

I got the same error as you do. most likely the user you use to run the process does not have access to specified resource (exe file)

try to move your exe to some other location and/or give your user access rights to the file.

miro smelko
  • 139
  • 6
0

Sounds like the process can't see the Z: drive or doesn't have security access. What user context does the app run under? Perhaps the Z: drive is not available in that context.

PowerApp101
  • 1,798
  • 1
  • 18
  • 25