Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Alright so I have been reading through the various answers on Super User for this question and no one has seemed to actually post a way of running a .bat file in Task Scheduler at PC startup. I would like to do this...

I tried having Task Scheduler start cmd.exe at PC startup with the arguments being the directory of the .bat file but it just does not work. Even if it says it does run the .bat the .bat's commands don't execute... How do I get it so it can run in Task Scheduler without this issue?

share|improve this question
    
>"Even if it says it does run the .bat". So your .bat does run. What kind of commands do you have in the .bat? Commands executed in the taskmanager are not visible and can't interact with the users desktop so you won't see these commands executed (or any programs started with it). They run "invisible". –  Rik Oct 5 '13 at 19:22
    
I am running deletion commands... –  Radical924 Oct 5 '13 at 19:38
    
Can we see your .bat file content, task trigger and task arguments? –  nixda Oct 5 '13 at 19:47
1  
Have you selected "Run whether user is logged on or not" or "Run only when user is logged on" radio button? Do you actually need to do that via Task Scheduler? You can run your bat file at startup by pasting a shortcut to the .bat file into: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup –  Nikola Dimitrijevic Oct 5 '13 at 20:08
    
Yeah I have... Here is the .bat file I have so far: pastebin.com/raw.php?i=WM9v4dS1 The files are not being deleted at startup as indicated in the lines f the .bat file... –  Radical924 Oct 6 '13 at 7:37

2 Answers 2

up vote 0 down vote accepted

Simply point the Scheduler's task to the .bat file itself. That is - in the Actions tab have Start a program entry that leads straight to the .bat file - not cmd.exe with parameters.

share|improve this answer
    
That won't work for some reason... Idk I am going to keep playing around with the user maybe that'll work... –  Radical924 Oct 5 '13 at 19:39
    
@Radical924 what do you mean by "won't work"? –  gronostaj Oct 5 '13 at 19:59
    
If you read my comment above the bat file will run but its commands do not execute... I will post my .bat that I have so far above in the comments. –  Radical924 Oct 6 '13 at 7:34
    
I ended up getting it working... I used the invisible.vbs script thing on here: superuser.com/questions/62525/run-a-completly-hidden-batch-file and followed the post and it all works now... Thanks though... idk why it wasn't working before but your post did make me look more into it and I found that post... –  Radical924 Oct 10 '13 at 7:50

I am using the "Startup" folder for bat files to be executed at the startup.

Copy your bat file in your "Startup" folder (for example C:\Users\*your username*\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup).

Replace exit by pause at the end of the bat file (exit is not needed here anyway). This is for testing purposes. The command prompt will not close until you will press a key. It is good way to see if there were any errors during the executing the commands from the bat file.

Remove the pause command when you are happy with the result.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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