Home > front end >  How to make a bat file so that it executes two different arguments
How to make a bat file so that it executes two different arguments

Time:12-05

I downloaded a project from Git that allows you to save books from various sites In order for it to work, you need to run cmd in the place where the repository is unzipped. For example, after running cmd and going to the repository location in cmd, to download the book, you need to do the following:

Elib2Ebook.exe -u https://author.today/work/212721 -f epub

Where "-u" is a mandatory argument followed by a link.

"-f" is a mandatory argument, followed by the format (for example fb2 or epub)

Elib2Ebook.exe - called program

The problem is to automate the process a little bit so that you don't have to enter arguments every time. That is , at startup .bat file I just need to enter the argument twice, that is, just insert the link and just specify the format.

I tried to implement it through %*, after call cmd, but I don't have enough knowledge to really do it, because the problem is that all the arguments need to be entered in one line, separated by the indication "-u" (URL) and "-f" (format)

CodePudding user response:

@echo off
setlocal
set /p "url=What URL https://"
set /p "type=Format : "
lib2Ebook.exe -u https://%url% -f %type%

Save as whatever.bat

Then run whatever

Respond to the first prompt with author.today/work/212721
and to the second with epub

Done!

[untried]

  • Related