1

I am trying to run a program, specifically CoreTemp 1.0, from a batch file. The user account I am trying to run from is a standard user and i need to run it without the UAC prompting, however i would prefer not to turn off UAC. The best solution I can come up with is run CoreTemp using a scheduled task with highest privileges using the command

runas /savecred /user:<username with admin access> "start /b schtasks /run /tn <task name>"

When I run this command while logged in as the standard user account, it returns error

2: The system cannot find the file specified.

Note the start /b is only there to keep the command window open and allow me to see the error code. Also note the <username with admin access> is not the default administrator account.

Does anyone have any idea what could be wrong, or even a better way to run the program from a standard user without the UAC prompt. I thought about enabling the default admin account and point the runas command to it, but i feel like that could lead to a massive security breech. Any way I go, the program needs to start from a batch command. I would also prefer to not need to use some third party program or exe to "whitelist" CoreTemp, but if that is the only option I am open to suggestions.

UPDATE: This question has not a duplicate question as the question referenced. I need to launch a program WITHOUT the UAC control popping up asking for permission.

JosefZ
  • 28,460
  • 5
  • 44
  • 83
David
  • 15
  • 5
  • _please_ use line breaks the next time ... – Marged Jun 17 '15 at 20:41
  • possible duplicate of [How can I auto-elevate my batch file, so that it requests from UAC administrator rights if required?](http://stackoverflow.com/questions/7044985/how-can-i-auto-elevate-my-batch-file-so-that-it-requests-from-uac-administrator) – Marged Jun 17 '15 at 20:43
  • @Marged How should i have used line breaks to make the formatting better? Also, this question is not a duplicate, as far as i could tell, because i need the program to execute WITHOUT the UAC prompt appearing, which would require user input. This program will be running and set to perform a certain task and then needs to be restarted during the middle of a sim study that takes hours to complete so the user will not be present the entire time to allow it to run. – David Jun 17 '15 at 20:54
  • the way JosefZ demonstrated – Marged Jun 17 '15 at 21:04
  • Oh... cool. I'll remember that for next time, thanks! I didn't know anybody could edit someone's question either.... interesting. – David Jun 17 '15 at 21:07
  • why not stick with the scheduled task ? As far as I know (and this is described here http://stackoverflow.com/questions/9632489/how-to-run-existing-windows-7-task-using-command-prompt too) you can setup a scheduled task which already stores the credentials for the task to be executed. And then you can simply start that scheduled task from an unprivileged users account without having to use runas. Or is this impossible because you have to restart it which is at least difficult when run as a scheduled task ? – Marged Jun 17 '15 at 21:15
  • If you want CoreTemp to run in the current session interactively as ``, then the session will have to be owned by said admin user. Since the current session is owned by your standard user, this approach cannot work as a way to bypass UAC. At best you could log the admin user on in another Windows session. Then the scheduler would run CoreTemp on that desktop, which you'd have to switch to. Or run CoreTemp non-interactively in the "services" session (#0), which I suppose would be pointless. – Eryk Sun Jun 19 '15 at 00:21
  • @Marged The issue with the scheduled task is when run from the command line (`schtasks /run /tn `) from any account other than the default admin, it returns error access denied. – David Jun 19 '15 at 11:42
  • @eryksun I do not completely follow what you mean about running it as a service. I do not know enough about services to know how that would work. From what you said about session ownership, i am now confused about how a scheduled service can run at logon of a user but cannot be called to run from cmd of said user. – David Jun 19 '15 at 11:56
  • If you schedule a task to run whether the user is logged on or not, it will be run in session 0. Starting with Windows Vista, session 0 is the non-interactive "Services" session. That's where the initial system processes run, i.e. System (ntoskrnl.exe), session manager (smss.exe), local session manager (lsm.exe), windows server (csrss.exe) for session 0, Windows init process (wininit.exe), local security authority (lsass.exe), service controller (services.exe), and service processes (individual and svchost.exe). – Eryk Sun Jun 19 '15 at 16:57

1 Answers1

0

I realize this question is quite old, but I think it might be helpful for someone searching "the system cannot find the file specified"; that question is not answered here.

Task Scheduler stores tasks in folders. If the taskname you're trying to run is in any folder other than the top level folder, you have to use the fully-qualfied task name. So, even if the /tn name you specify is "right", if it's stored in any folder other than the top level folder, you will get "ERROR: The system cannot find the file specified."

C:\Windows\system32>schtasks /run /tn "task in named folder" ERROR: The system cannot find the file specified.

C:\Windows\system32>schtasks /run /tn "\phil test\task in named folder" SUCCESS: Attempted to run the scheduled task "\phil test\task in named folder".

John Slegers
  • 45,213
  • 22
  • 199
  • 169
user318814
  • 11
  • 4