I have a batch script that runs some programs at once. One of them requires admin access, so it's fine to manually give it. But now I am adding another admin program. I would not like to manually give admin access to two programs.

The apparent solution is to run the whole script as admin. Works.

But, I'd also like to not give admin access to the other programs. What would be the best way to run those in user-mode?

I found this question, but trying to run any command tells me that the command is invalid.

EDIT: I tried to run different commands with the at command, but it did not work.

C:\Windows\system32>at notepad
Invalid command.

<then prints out help for the command>

(I am not sure if the exact text is "Invalid command" as my Windows is in Finnish, but that is the closest translation I can think of. If someone knows better it's "Komento ei kelpaa." in Finnish.)

EDIT 2: I also tried adding the directory and quotes to the command. No effect.

  • The one answer on the linked question is a suggesting to schedule a task (using AT), which makes sense. But you're saying "but trying to run any command tells me that the command is invalid.", I'm not sure how that's related to the question you linked? What commands are you trying to use to set up the task? Jan 31 '14 at 17:40
  • @techie007 Edited, I tried at as suggested in the answer. And flagging it as a duplicate seems funny as I linked the exact same question and told it didn't work. Jan 31 '14 at 18:20
  • Just saying "It didn't work" isn't enough for us (me at least anyways) to consider this a different question. Even if the accepted answer doesn't work at all, it's still the same question. consider placing a bounty on the existing one instead, in an attempt to get newer/better/more answers. Also, based on your edits, you're just using AT wrong. :) You need to specify a time and a command (at minimum). Jan 31 '14 at 18:29
  • @techie007 Oops, misinterpreted the help in the command. I thought the time was in []... Jan 31 '14 at 18:31
  • Also, in case you want to automatically set the time to Now + 1 minute or alike, see Add minutes to time in batch (using arithmetic). Jan 31 '14 at 18:32

With AT, you must provide a time when you want the task to start. I prefer not to re-invent the wheel, so I will point you to Rob van der Woude's Date and Time batch examples, and will refer you to use/read/study the AtFuture.bat script, which takes two arguments (plus an optional one) to schedule a task in the future.

One caveat: AT runs tasks as the Local System account. So you will be running as an admin, and won't have access to network resources. Keep that in mind when using such a solution.

Hope it helps somewhat.

Not the answer you're looking for? Browse other questions tagged or ask your own question.