Updating in Windows using -U or --update switch results in cmd crash #11234

Open
opened 2026-02-21 04:35:20 -05:00 by deekerman · 6 comments
Owner

Originally created by @xCONFLiCTiONx on GitHub (Jul 9, 2017).

Updating in windows causes cmd to crash and I believe the problem is in the batch file code.

`
@echo off
echo Waiting for file handle to be closed ...
ping 127.0.0.1 -n 5 -w 1000 > NUL
move /Y "C:\Michael Hall\Workspace\Development\Old Projects\MediaDownloader\MediaDownloader\bin\Release\youtube-dl.exe.new" "C:\Michael Hall\Workspace\Development\Old Projects\MediaDownloader\MediaDownloader\bin\Release\youtube-dl.exe" > NUL
echo Updated youtube-dl to version 2017.07.09.
start /b "" cmd /c del "%~f0"&exit /b"

`

Should not the last line have 2 & and spaces? Eg. start /b "" cmd /c del "%~f0" && exit /b" or even better:
start /b "" cmd /c del "%~f0"
exit
untitled

Honestly I don't know but it gets stuck in cmd window and throws an error if using C# for example for standard output;

Originally created by @xCONFLiCTiONx on GitHub (Jul 9, 2017). Updating in windows causes cmd to crash and I believe the problem is in the batch file code. ` @echo off echo Waiting for file handle to be closed ... ping 127.0.0.1 -n 5 -w 1000 > NUL move /Y "C:\Michael Hall\Workspace\Development\Old Projects\MediaDownloader\MediaDownloader\bin\Release\youtube-dl.exe.new" "C:\Michael Hall\Workspace\Development\Old Projects\MediaDownloader\MediaDownloader\bin\Release\youtube-dl.exe" > NUL echo Updated youtube-dl to version 2017.07.09. start /b "" cmd /c del "%~f0"&exit /b" ` Should not the last line have 2 & and spaces? Eg. start /b "" cmd /c del "%~f0" && exit /b" or even better: start /b "" cmd /c del "%~f0" exit ![untitled](https://user-images.githubusercontent.com/12835195/27995903-0b32c86a-649c-11e7-8b47-d7e31320566b.png) Honestly I don't know but it gets stuck in cmd window and throws an error if using C# for example for standard output;
Author
Owner

@dstftw commented on GitHub (Jul 9, 2017):

No, it should not.

@dstftw commented on GitHub (Jul 9, 2017): No, it should not.
Author
Owner

@siddht4 commented on GitHub (Jul 10, 2017):

Try this one once.Copy your executable to any folder residing in any other drive other than C. eg : In d: drive. paste youtube-dl.exe there. copy this into bat file @echo off youtube-dl.exe -U to update. Then try to download something. Try this @echo off youtube-dl [url]. Please provide did these two succed.

The first should update the youtube-dl.exe and close itself. The other should download some video which you provided instead of [url] and close itself.Anything other than these is a windows issue

@siddht4 commented on GitHub (Jul 10, 2017): Try this one once.Copy your executable to any folder residing in any other drive other than C. eg : In d: drive. paste youtube-dl.exe there. copy this into bat file `@echo off youtube-dl.exe -U` to update. Then try to download something. Try this `@echo off youtube-dl [url]`. Please provide did these two succed. The first should update the youtube-dl.exe and close itself. The other should download some video which you provided instead of [url] and close itself.Anything other than these is a windows issue
Author
Owner

@xCONFLiCTiONx commented on GitHub (Jul 10, 2017):

I cant seem to narrow it down to where the problem is and I made a workaround for my application...

@xCONFLiCTiONx commented on GitHub (Jul 10, 2017): I cant seem to narrow it down to where the problem is and I made a workaround for my application...
Author
Owner

@siddht4 commented on GitHub (Jul 12, 2017):

@mikeyhalla If the problem was fixed with a workaround you can help others who may have similar or same issue.

If you simply put these in your batch file,cmd would run,read the script,update youtube-dl and exit itself

the script being
@echo off youtube-dl.exe -U

If the script is not being called then either you dont have youtube-dl.exe in the path where the batch file is present or their is cmd restriction in your active directory.Which can done via invoking c:\windows\system32\cmd.exe.

By the way the error code is likely due to these issues. http://www.techsupportforum.com/forums/f10/solved-error-0xc0000142-178253.html

@siddht4 commented on GitHub (Jul 12, 2017): @mikeyhalla If the problem was fixed with a workaround you can help others who may have similar or same issue. If you simply put these in your batch file,cmd would run,read the script,update youtube-dl and exit itself the script being `@echo off youtube-dl.exe -U` If the script is not being called then either you dont have youtube-dl.exe in the path where the batch file is present or their is cmd restriction in your active directory.Which can done via invoking c:\windows\system32\cmd.exe. By the way the error code is likely due to these issues. http://www.techsupportforum.com/forums/f10/solved-error-0xc0000142-178253.html
Author
Owner

@xCONFLiCTiONx commented on GitHub (Jul 12, 2017):

Yeah, thx but I tried pretty much everything to fix it and since I don't code in Python then I can't test youtube-dl. But just to let you know it only happens when the batch file is created for replacing the file.

My workaround was to create another exe that runs the update and ends before the update is finished so no error is even acknowledged.

I suggest the dev take a close look at this issue. I am pretty wise about my computer and this is the only program giving me problems. Bugs happen whether it be in youtube-dl or mine. I cant find it in mine so I just did the workaround.

@xCONFLiCTiONx commented on GitHub (Jul 12, 2017): Yeah, thx but I tried pretty much everything to fix it and since I don't code in Python then I can't test youtube-dl. But just to let you know it only happens when the batch file is created for replacing the file. My workaround was to create another exe that runs the update and ends before the update is finished so no error is even acknowledged. I suggest the dev take a close look at this issue. I am pretty wise about my computer and this is the only program giving me problems. Bugs happen whether it be in youtube-dl or mine. I cant find it in mine so I just did the workaround.
Author
Owner

@siddht4 commented on GitHub (Jul 12, 2017):

okay but as I am a developer,not here though.If you have python 2.7 installed try this one once.Open this in browser or any dowonload manager https://yt-dl.org/downloads/latest/youtube-dl.You will find a 1.5 MB youtube-dl file.As soon as it downloads run cmd and type the command "python youtube-dl".If it works its ok so far.Then in the file add .zip extension and unzip it via winzip or winrar or any utlitiy. The folder structure will have

  • youtube-dl [folder]
  • main.py [file]

Navigate to this folder using cd,and once its reaches.Try this in terminal "python main.py ".If it works then write a batch script here that would contain these codes for now. @echo off python __main__.py set /p DUMMY=Hit ENTER to continue.... Run the batch script and tell which part had the issue.

@siddht4 commented on GitHub (Jul 12, 2017): okay but as I am a developer,not here though.If you have python 2.7 installed try this one once.Open this in browser or any dowonload manager https://yt-dl.org/downloads/latest/youtube-dl.You will find a 1.5 MB youtube-dl file.As soon as it downloads run cmd and type the command "python youtube-dl".If it works its ok so far.Then in the file add .zip extension and unzip it via winzip or winrar or any utlitiy. The folder structure will have - youtube-dl [folder] - __main__.py [file] Navigate to this folder using cd,and once its reaches.Try this in terminal "python __main__.py ".If it works then write a batch script here that would contain these codes for now. `@echo off python __main__.py set /p DUMMY=Hit ENTER to continue...`. Run the batch script and tell which part had the issue.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/youtube-dl#11234
No description provided.