Task Scheduler Bug in Windows 10 - How it's broken and how to work around it.

  Рет қаралды 2,744

andycivil

andycivil

Күн бұрын

I tried to schedule my own task in Windows 10, and as of today November 2019 there's a bug in the wizard that prevented me from creating it until I found a workaround. I'm going to show you the bug, and what I did to get around it.
First, I'm going to create a working example task in the tradition of "hello world" so that I can use it to demonstrate the problem.
I'm using the windows key plus 'r' to run a program by name. I'll start by making a directory to put my demo files in. Then I'll change directory to it, and use notepad to create a very simple visual basic script file.
I'll just put a message box that says hello. And if I run that by typing its name, you'll see what it does.
And incidentally, if I bring up the folder with this file in it, and double click it, the same message box comes up.
So I'm going to use this example task to demonstrate the process of using the task scheduler wizard, as though I wanted to do this task every day or upon some other trigger. You can find the task scheduler wizard somewhere in the Windows Administrative Tools, but I find it easier to remember the name.
So this is what the task scheduler looks like, we go into the tasks library. You'll probably find tasks in there that applications have added for themselves, but I'm going to add my own. Right click and "Create a Basic Task..." you'll have to give it a name. But for the purposes of this demonstration, I'll keep the defaults since I don't even need to get it to trigger. The important bit is that under "Start a Program" I browse to my "hello" file and accept the path to it. After clicking "Finish" the task would be set to run every day at this time, but I can run it immediately with the context menu. And in this case, it works as it should.
OK, I'll get rid of that working one and show how it goes wrong. I'm going to go into my folder structure, go up one folder and rename KZbin to You Tube. Now I'm going back to the task scheduler and do exactly what I did before, but with the file in the renamed location.
OK it all looks the same, but when I try to run the program it asks me "How do you want to open this file?". This seems a very strange question until you realise what happened here. To demonstrate, I'll pick "Notepad" because it gives a useful error message. Here we go: It "Cannot find the file" which is darn strange since we just browsed to it with file explorer. But look carefully at the file it can't find: it stops at the space. There's clearly a parsing error due to the space in the file name. It's added ".txt" as a default extension for Notepad. I can tell you, I looked for a way to fix this with all different kinds of quoting on the path, but if I tried to add quotes, the wizard tried to handle the space by parsing what followed as command parameters. Basically the wizard and the scheduler disagreed about the number of quotes present.
I did find a sane workaround, and I'll show it to you. I had to use the export/import mechanism. I use the context menu on the broken task, and choose "Export..." which saves it to an xml file. I'm going to edit it with notepad++ because of syntax highlighting but you can use the regular one.There's the path of the command. It already has quotes, so the task scheduler obviously adds another layer of quotes and they end up cancelled out. I'll remove the quotes and save the file.
Now, let's try adding that. I need the "Import..." option. There it is, opens in the right folder to its credit. Oh, OK, I can't have two tasks with the same name, the broken one is still there, so I'll add a 1 to this one's name. Accept that and try it, and there we are, it's working again even with the space in the name.
I hope that made sense and the workaround is useful for you, and as always, thanks for watching to the end.

Пікірлер: 4
@HaloWarZone
@HaloWarZone 3 жыл бұрын
This helped me so much, its so specific i though i wasn't gonna find anyone with the same issue, cheers mate
@andycivil
@andycivil 3 жыл бұрын
Clearly, it is obscure! You seem to be the only one who's been nice enough to comment. I think there are billions of Windows users out there who simply don't schedule tasks. The scheduler is more there to serve other programs (e.g. scheduled backups) and in that case it's scripted and the bug doesn't manifest. Anyway, glad I could help someone! P.S. this is why Linux is better than Windows; if it were open source, I could submit a bug report and a fix and it would be done with. But if I tried to tell Microsoft there was a bug, their approach to me would be that it was user error.
@HaloWarZone
@HaloWarZone 3 жыл бұрын
@@andycivil you're a hero, btw i use it as an alarm, to execute music and stuff so i can wake up at max volume XD, keep up the good work man
@soiledhalo2296
@soiledhalo2296 3 жыл бұрын
@@andycivil I have major task scheduler issues, but that's with Windows Server 2019 and 2022. Weekly tasks that are scheduled to run every 2 weeks run weekly. i've seen other users complain about the same thing. With regards to the .vbs issue. We had something similar, but it worked on some of our jobs, and failed on others. Eventually they just worked again.
How to Run a Python Program with Windows Task Scheduler
9:07
Brandon Jacobson (Jacobson Enterprises)
Рет қаралды 16 М.
To Brawl AND BEYOND!
00:51
Brawl Stars
Рет қаралды 17 МЛН
NEVER install these programs on your PC... EVER!!!
19:26
JayzTwoCents
Рет қаралды 4,9 МЛН
Glimmer and Gloom - Medium level solve in seconds
2:53
andycivil
Рет қаралды 2,3 М.
12 Mistakes That Make Your Book Look Amateurish
15:34
Bookfox
Рет қаралды 48 М.
💀 R.I.P. YouTube Tutorials: Gemini 2.0 AI is the NEW Teacher
10:00
Teacher's Tech
Рет қаралды 146 М.
How to fix a remote control that's not working
4:48
andycivil
Рет қаралды 1,1 М.
100% Disk Usage in Windows 10 Tips
13:26
CyberCPU Tech
Рет қаралды 1,2 МЛН
DOS Commands You Should Know
27:13
CyberCPU Tech
Рет қаралды 108 М.
Гига богатый геймер vs бедный геймер
30:55
Трум Трум Оки Токи
Рет қаралды 114 М.
для всей семьи
0:56
Стакановец
Рет қаралды 191 М.
BIP HOUSE  .бип хаус 🥰🏡  #shorts
0:13
bip_house
Рет қаралды 1,2 МЛН
#trending #foryou #challenge #fyp #viral #short #tiktok #vs
0:15
Misiсatсh
Рет қаралды 2,4 МЛН
BIP HOUSE  .бип хаус 🥰🏡  #shorts
0:13
bip_house
Рет қаралды 1,2 МЛН