2

Using Windows 10 here.

Code in open_video.bat

"%USERPROFILE%\Desktop\VLCPortable media player\VLCPortable.exe" --start-time=54 --stop-time=89 "%USERPROFILE%\Downloads\some_video.mkv"

Location of open_video.bat is C:

in Notepad++ I have this link below and I call the batch file by double-clicking on it:

file:///C:\open_video.bat

When I double-click the batch file, it opens some_video.mkv in VLC starting at the 54 second mark, plays it up to the 89 second mark, and then loops the video between those two timestamps.

However, I don't want to hard code 54 and 89. Is there any way I can write the link to the batch file, and modify the code in the batch file such that I can pass 54 or whatever and 89 or whatever as a parameter or argument?

E.g., re-write the link to the batch file to something like:

file:///C:\open_video.bat?start=54&end=89

and modify the batch file's code like so:

"%USERPROFILE%\Desktop\VLCPortable media player\VLCPortable.exe" --start-time=start --stop-time=end "%USERPROFILE%\Downloads\some_video.mkv"

or some such?

0

2 Answers 2

1

You can modify the batch file like this:

"%USERPROFILE%\Desktop\VLCPortable media player\VLCPortable.exe" --start-time=%1 --stop-time=%2 "%USERPROFILE%\Downloads\some_video.mkv"

Then call it like:

C:\open_video.bat 54 89

Or in file URI:

file:///C:\open_video.bat%2054%2089

In encoded URL %20 is space and replace 54 and 89 with parameters.

3
  • You got exactly what I was trying to do. Kudos for that. I really want this solution to work via file URI. And had even tried it earlier but it didn't work. I'm sure it works via the command line, but when I encode the file URI the way you've shown it, nothing happens when I double click the URI. I think Windows is unable to read that I'm trying to open a batch file, and doesn't bother to run it. Upvoted for trying to help. Commented Sep 17, 2020 at 2:05
  • 1
    @thanks_in_advanced is there any specific reason you want to use File URI?
    – Wasif
    Commented Sep 17, 2020 at 2:08
  • 1
    Am trying to create links in Markdown (app is Joplin) such that I can play short pieces from a large, long, locally stored video. Currently, I'm creating a separate batch file for each clip I want to play (with start and end points). I was thinking that maybe I can have a single batch file, and pass it the start and end parameters when writing the link in Markdown. That way I won't need a large number of batch files. But it's looking to me like there may not be such a way possible, so am resigned to simply create a large number of batch files. Commented Sep 17, 2020 at 2:12
1

As this answer (paraphrased) explains, this does not appear to be possible in most contexts:

I assume that you are using Windows? If so, there is no way to pass a parameter using the file:// syntax, as it is an Asynchronous Pluggable Protocol, and APPs do not accept parameters.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .