|
-
Apr 19th, 2017, 12:53 PM
#1
[RESOLVED] The system cannot find the file specified - but I can
Hey all,
I'm putting together a method to switch users on a kiosk app and am trying to use this code...
Code:
Const fName = "C:\Windows\System32\tsdiscon.exe"
Process.Start(fName)
When I run that, I get a Win32Exception on the call to Process.Start saying the file cannot be found. If however I copy and paste the file name into a cmd prompt it runs fine. Just for giggles, I tried using Shell, but get similar results.
So if the file is there why is it not there?
Can anyone reproduce it or is it just me?
Maybe a security setting on my machine?
I've tried starting VS2013 with admin rights but it makes no difference.
Please note that if you are going to try this code, you will (should) be disconnected and shown the switch user screen from which you can log right back in.
Process control doesn't give you good quality, it gives you consistent quality.
Good quality comes from consistently doing the right things.
Vague general questions have vague general answers. A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.
______________________________ Last edited by kebo : Now. Reason: superfluous typo's
-
Apr 19th, 2017, 01:17 PM
#2
Re: The system cannot find the file specified - but I can
 Originally Posted by kebo
Hey all,
I'm putting together a method to switch users on a kiosk app and am trying to use this code...
Code:
Const fName = "C:\Windows\System32\tsdiscon.exe"
Process.Start(fName)
When I run that, I get a Win32Exception on the call to Process.Start saying the file cannot be found. If however I copy and paste the file name into a cmd prompt it runs fine. Just for giggles, I tried using Shell, but get similar results.
So if the file is there why is it not there?
Can anyone reproduce it or is it just me?
Maybe a security setting on my machine?
I've tried starting VS2013 with admin rights but it makes no difference.
Please note that if you are going to try this code, you will (should) be disconnected and shown the switch user screen from which you can log right back in.
The Windows (and especially the Windows\System32) folders are protected from programs by Windows, so my big question is why are you trying to run a system program from yours?
If that exe file is something you made, why not have it be installed in the Program Files or Program Files (x86) folders where they can be called from other programs?
-
Apr 19th, 2017, 01:29 PM
#3
Re: The system cannot find the file specified - but I can
why are you trying to run a system program from yours?
If that exe file is something you made...
I didn't make it; it should be on a win7/10 machine in the system32 folder.
I am calling it to invoke the switch user screen so the admins can update the kiosk hardware. This machine will be set up with a guest account that automatically logs in when the machine (or tablet) boots. When the guest account loads, the shell application (i.e. explorer) is replaced by a custom app. There is no task bar, start menu, etc., there is only the functionality I provide. Being able to switch users is one of those functions, and calling tsdiscon.exe is the cleanest way I have found to do it.
Also, this runs just fine so it doesn't seem to be a permissions issue...
Code:
Const fName = "C:\Windows\System32\explorer.exe"
Process.Start(fName)
Last edited by kebo; Apr 19th, 2017 at 01:32 PM.
Process control doesn't give you good quality, it gives you consistent quality.
Good quality comes from consistently doing the right things.
Vague general questions have vague general answers. A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.
______________________________ Last edited by kebo : Now. Reason: superfluous typo's
-
Apr 19th, 2017, 06:04 PM
#4
Re: The system cannot find the file specified - but I can
 Originally Posted by kebo
I didn't make it; it should be on a win7/10 machine in the system32 folder.
I am calling it to invoke the switch user screen so the admins can update the kiosk hardware. This machine will be set up with a guest account that automatically logs in when the machine (or tablet) boots. When the guest account loads, the shell application (i.e. explorer) is replaced by a custom app. There is no task bar, start menu, etc., there is only the functionality I provide. Being able to switch users is one of those functions, and calling tsdiscon.exe is the cleanest way I have found to do it.
Also, this runs just fine so it doesn't seem to be a permissions issue...
Code:
Const fName = "C:\Windows\System32\explorer.exe"
Process.Start(fName)
Ok, I looked up what tsdiscon does as I wasn't familiar with that program, after a little bit of googling I came across this that has links to some api calls that will do the windows user switching. How to Programatically switch users in windows 7?
I've never done something like this so it'd take me some time to fiddle with it to see if it works and how well, will be a few days before I can begin to play with this.
-
Apr 19th, 2017, 06:21 PM
#5
Re: The system cannot find the file specified - but I can
Thanks for that.
I finally have the answer as to why Process.Start can't find the file when I can though; File System Redirector . I am building a 32 bit app and running a 64 bit machine so the call path is being redirected by Windows.
Working code,
Code:
Const fname = "C:\Windows\Sysnative\tsdiscon.exe"
Process.Start(fname)
Credit to David Heffernan's SO reply.
Last edited by kebo; Apr 19th, 2017 at 07:05 PM.
Process control doesn't give you good quality, it gives you consistent quality.
Good quality comes from consistently doing the right things.
Vague general questions have vague general answers. A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.
______________________________ Last edited by kebo : Now. Reason: superfluous typo's
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|