0

When I run a batch file containing the following:

@echo off
set /p userinput=C:/youtube-dl.exe -o "%%cd%%/%%(title)s.%%(ext)s" 
C:/youtube-dl.exe  -o "%%cd%%/%%(title)s.%%(ext)s" %userinput%
pause

I get the following error: "TypeError: %c requires int or char"

It seems the problem is with the %cd% variable where I want the program to take the directory from which it was launched.

I have made sure to wrap the variable in double percent signs, so I don't see what the issue is. This executes just fine if I manually type it in Command Prompt (without the %userinput% section and of course with single percent signs for the variables).

Here's an image for the full console window:

enter image description here

0

1 Answer 1

0

Try this:

@echo off
set /p userinput=C:/youtube-dl.exe -o "%cd%/%%(title)s.%%(ext)s" 
C:/youtube-dl.exe -o "%cd%/%%(title)s.%%(ext)s" %userinput%
pause

The difference is that %cd%, which is an environment variable, should be wrapped with only one pair of percent signs.

Source: https://github.com/rg3/youtube-dl/blob/master/README.md#readme

However you should not touch %'s that are not plain characters, e.g. environment variables for expansion should stay intact: -o "C:\%HOMEPATH%\Desktop\%%(title)s.%%(ext)s".

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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