I want to add cover art to all the MKVs in a folder
I'm trying to batch add cover art to all my MKV files in Windows using Batch scripting but I can't. My file structure is like this:
Video1.mkv
Video1.jpg
Both video and image have the same filename, the only difference is the extension.
I've tried the following command:
FOR %%f IN (*.mkv) DO (
mkvpropedit.exe "%%~nf.mkv" --attachment-name "cover" --attachment-mime-type
"image/jpeg" --add-attachment "%%~nf.jpg"
)
It's weird how this command works for other apps and it's not working for MKVPropedit.
The result is:
Error: The file '%%~nf.jpg' could not be opened for reading: open file error.
My jpg files are not corrupt so I don't really know what that error means.
windows command-line batch matroska
New contributor
add a comment |
I'm trying to batch add cover art to all my MKV files in Windows using Batch scripting but I can't. My file structure is like this:
Video1.mkv
Video1.jpg
Both video and image have the same filename, the only difference is the extension.
I've tried the following command:
FOR %%f IN (*.mkv) DO (
mkvpropedit.exe "%%~nf.mkv" --attachment-name "cover" --attachment-mime-type
"image/jpeg" --add-attachment "%%~nf.jpg"
)
It's weird how this command works for other apps and it's not working for MKVPropedit.
The result is:
Error: The file '%%~nf.jpg' could not be opened for reading: open file error.
My jpg files are not corrupt so I don't really know what that error means.
windows command-line batch matroska
New contributor
add a comment |
I'm trying to batch add cover art to all my MKV files in Windows using Batch scripting but I can't. My file structure is like this:
Video1.mkv
Video1.jpg
Both video and image have the same filename, the only difference is the extension.
I've tried the following command:
FOR %%f IN (*.mkv) DO (
mkvpropedit.exe "%%~nf.mkv" --attachment-name "cover" --attachment-mime-type
"image/jpeg" --add-attachment "%%~nf.jpg"
)
It's weird how this command works for other apps and it's not working for MKVPropedit.
The result is:
Error: The file '%%~nf.jpg' could not be opened for reading: open file error.
My jpg files are not corrupt so I don't really know what that error means.
windows command-line batch matroska
New contributor
I'm trying to batch add cover art to all my MKV files in Windows using Batch scripting but I can't. My file structure is like this:
Video1.mkv
Video1.jpg
Both video and image have the same filename, the only difference is the extension.
I've tried the following command:
FOR %%f IN (*.mkv) DO (
mkvpropedit.exe "%%~nf.mkv" --attachment-name "cover" --attachment-mime-type
"image/jpeg" --add-attachment "%%~nf.jpg"
)
It's weird how this command works for other apps and it's not working for MKVPropedit.
The result is:
Error: The file '%%~nf.jpg' could not be opened for reading: open file error.
My jpg files are not corrupt so I don't really know what that error means.
windows command-line batch matroska
windows command-line batch matroska
New contributor
New contributor
edited Jan 7 at 11:55
Ahmed Ashour
1,146611
1,146611
New contributor
asked Jan 7 at 11:50
G. L.G. L.
358
358
New contributor
New contributor
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You should use a different variable letter in your FOR command. The letter f is one of the pathname format letters (the complete list is a, d, f, n, p, s, t, x
). For example, use G as shown here:
FOR %%G IN (*.mkv) DO (mkvpropedit.exe "%%~nG.mkv" --attachment-name "cover" --attachment-mime-type "image/jpeg" --add-attachment "%%~nG.jpg")
According to SS64.com G is a good choice because it provides the longest run of letters that don't conflict with any of the pathname format letters:
%%G is a good choice because it does not conflict with any of the pathname format letters (a, d, f, n, p, s, t, x) and provides the longest run of non-conflicting letters for use as implicit parameters.
G > H > I > J > K > L > M
Further, if you're running this directly from the command prompt, you need to use single % characters, not double, as shown here:
FOR %G IN (*.mkv) DO (mkvpropedit.exe "%~nG.mkv" --attachment-name "cover" --attachment-mime-type "image/jpeg" --add-attachment "%~nG.jpg")
This Stack Overflow answer provides more information on using FOR in and outside of batch scripts.
Your command didn't work. I got the result: %%G unexpected at this time.
– G. L.
Jan 7 at 12:20
See updated answer.
– Twisty Impersonator
Jan 7 at 12:27
So there are differences? I didn't know. So if I want to use it in a .bat file, which is my intention, I should use it with %%G? If I want to use it directly from the command prompt, I should use %G? Very interesting.
– G. L.
Jan 7 at 12:30
See the link I provided for info about why you need to use two % only in a batch file. The coffee if the letter G is simply to avoid other letters that have other uses.
– Twisty Impersonator
Jan 7 at 12:32
Thanks a lot, man. Really nice. I was trying this for day and I didn't know about. I found about it right here: ss64.com/nt/syntax-args.html
– G. L.
Jan 7 at 12:34
|
show 5 more comments
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
G. L. is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1391469%2fi-want-to-add-cover-art-to-all-the-mkvs-in-a-folder%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You should use a different variable letter in your FOR command. The letter f is one of the pathname format letters (the complete list is a, d, f, n, p, s, t, x
). For example, use G as shown here:
FOR %%G IN (*.mkv) DO (mkvpropedit.exe "%%~nG.mkv" --attachment-name "cover" --attachment-mime-type "image/jpeg" --add-attachment "%%~nG.jpg")
According to SS64.com G is a good choice because it provides the longest run of letters that don't conflict with any of the pathname format letters:
%%G is a good choice because it does not conflict with any of the pathname format letters (a, d, f, n, p, s, t, x) and provides the longest run of non-conflicting letters for use as implicit parameters.
G > H > I > J > K > L > M
Further, if you're running this directly from the command prompt, you need to use single % characters, not double, as shown here:
FOR %G IN (*.mkv) DO (mkvpropedit.exe "%~nG.mkv" --attachment-name "cover" --attachment-mime-type "image/jpeg" --add-attachment "%~nG.jpg")
This Stack Overflow answer provides more information on using FOR in and outside of batch scripts.
Your command didn't work. I got the result: %%G unexpected at this time.
– G. L.
Jan 7 at 12:20
See updated answer.
– Twisty Impersonator
Jan 7 at 12:27
So there are differences? I didn't know. So if I want to use it in a .bat file, which is my intention, I should use it with %%G? If I want to use it directly from the command prompt, I should use %G? Very interesting.
– G. L.
Jan 7 at 12:30
See the link I provided for info about why you need to use two % only in a batch file. The coffee if the letter G is simply to avoid other letters that have other uses.
– Twisty Impersonator
Jan 7 at 12:32
Thanks a lot, man. Really nice. I was trying this for day and I didn't know about. I found about it right here: ss64.com/nt/syntax-args.html
– G. L.
Jan 7 at 12:34
|
show 5 more comments
You should use a different variable letter in your FOR command. The letter f is one of the pathname format letters (the complete list is a, d, f, n, p, s, t, x
). For example, use G as shown here:
FOR %%G IN (*.mkv) DO (mkvpropedit.exe "%%~nG.mkv" --attachment-name "cover" --attachment-mime-type "image/jpeg" --add-attachment "%%~nG.jpg")
According to SS64.com G is a good choice because it provides the longest run of letters that don't conflict with any of the pathname format letters:
%%G is a good choice because it does not conflict with any of the pathname format letters (a, d, f, n, p, s, t, x) and provides the longest run of non-conflicting letters for use as implicit parameters.
G > H > I > J > K > L > M
Further, if you're running this directly from the command prompt, you need to use single % characters, not double, as shown here:
FOR %G IN (*.mkv) DO (mkvpropedit.exe "%~nG.mkv" --attachment-name "cover" --attachment-mime-type "image/jpeg" --add-attachment "%~nG.jpg")
This Stack Overflow answer provides more information on using FOR in and outside of batch scripts.
Your command didn't work. I got the result: %%G unexpected at this time.
– G. L.
Jan 7 at 12:20
See updated answer.
– Twisty Impersonator
Jan 7 at 12:27
So there are differences? I didn't know. So if I want to use it in a .bat file, which is my intention, I should use it with %%G? If I want to use it directly from the command prompt, I should use %G? Very interesting.
– G. L.
Jan 7 at 12:30
See the link I provided for info about why you need to use two % only in a batch file. The coffee if the letter G is simply to avoid other letters that have other uses.
– Twisty Impersonator
Jan 7 at 12:32
Thanks a lot, man. Really nice. I was trying this for day and I didn't know about. I found about it right here: ss64.com/nt/syntax-args.html
– G. L.
Jan 7 at 12:34
|
show 5 more comments
You should use a different variable letter in your FOR command. The letter f is one of the pathname format letters (the complete list is a, d, f, n, p, s, t, x
). For example, use G as shown here:
FOR %%G IN (*.mkv) DO (mkvpropedit.exe "%%~nG.mkv" --attachment-name "cover" --attachment-mime-type "image/jpeg" --add-attachment "%%~nG.jpg")
According to SS64.com G is a good choice because it provides the longest run of letters that don't conflict with any of the pathname format letters:
%%G is a good choice because it does not conflict with any of the pathname format letters (a, d, f, n, p, s, t, x) and provides the longest run of non-conflicting letters for use as implicit parameters.
G > H > I > J > K > L > M
Further, if you're running this directly from the command prompt, you need to use single % characters, not double, as shown here:
FOR %G IN (*.mkv) DO (mkvpropedit.exe "%~nG.mkv" --attachment-name "cover" --attachment-mime-type "image/jpeg" --add-attachment "%~nG.jpg")
This Stack Overflow answer provides more information on using FOR in and outside of batch scripts.
You should use a different variable letter in your FOR command. The letter f is one of the pathname format letters (the complete list is a, d, f, n, p, s, t, x
). For example, use G as shown here:
FOR %%G IN (*.mkv) DO (mkvpropedit.exe "%%~nG.mkv" --attachment-name "cover" --attachment-mime-type "image/jpeg" --add-attachment "%%~nG.jpg")
According to SS64.com G is a good choice because it provides the longest run of letters that don't conflict with any of the pathname format letters:
%%G is a good choice because it does not conflict with any of the pathname format letters (a, d, f, n, p, s, t, x) and provides the longest run of non-conflicting letters for use as implicit parameters.
G > H > I > J > K > L > M
Further, if you're running this directly from the command prompt, you need to use single % characters, not double, as shown here:
FOR %G IN (*.mkv) DO (mkvpropedit.exe "%~nG.mkv" --attachment-name "cover" --attachment-mime-type "image/jpeg" --add-attachment "%~nG.jpg")
This Stack Overflow answer provides more information on using FOR in and outside of batch scripts.
edited Jan 7 at 15:53
answered Jan 7 at 12:19
Twisty ImpersonatorTwisty Impersonator
18.1k146596
18.1k146596
Your command didn't work. I got the result: %%G unexpected at this time.
– G. L.
Jan 7 at 12:20
See updated answer.
– Twisty Impersonator
Jan 7 at 12:27
So there are differences? I didn't know. So if I want to use it in a .bat file, which is my intention, I should use it with %%G? If I want to use it directly from the command prompt, I should use %G? Very interesting.
– G. L.
Jan 7 at 12:30
See the link I provided for info about why you need to use two % only in a batch file. The coffee if the letter G is simply to avoid other letters that have other uses.
– Twisty Impersonator
Jan 7 at 12:32
Thanks a lot, man. Really nice. I was trying this for day and I didn't know about. I found about it right here: ss64.com/nt/syntax-args.html
– G. L.
Jan 7 at 12:34
|
show 5 more comments
Your command didn't work. I got the result: %%G unexpected at this time.
– G. L.
Jan 7 at 12:20
See updated answer.
– Twisty Impersonator
Jan 7 at 12:27
So there are differences? I didn't know. So if I want to use it in a .bat file, which is my intention, I should use it with %%G? If I want to use it directly from the command prompt, I should use %G? Very interesting.
– G. L.
Jan 7 at 12:30
See the link I provided for info about why you need to use two % only in a batch file. The coffee if the letter G is simply to avoid other letters that have other uses.
– Twisty Impersonator
Jan 7 at 12:32
Thanks a lot, man. Really nice. I was trying this for day and I didn't know about. I found about it right here: ss64.com/nt/syntax-args.html
– G. L.
Jan 7 at 12:34
Your command didn't work. I got the result: %%G unexpected at this time.
– G. L.
Jan 7 at 12:20
Your command didn't work. I got the result: %%G unexpected at this time.
– G. L.
Jan 7 at 12:20
See updated answer.
– Twisty Impersonator
Jan 7 at 12:27
See updated answer.
– Twisty Impersonator
Jan 7 at 12:27
So there are differences? I didn't know. So if I want to use it in a .bat file, which is my intention, I should use it with %%G? If I want to use it directly from the command prompt, I should use %G? Very interesting.
– G. L.
Jan 7 at 12:30
So there are differences? I didn't know. So if I want to use it in a .bat file, which is my intention, I should use it with %%G? If I want to use it directly from the command prompt, I should use %G? Very interesting.
– G. L.
Jan 7 at 12:30
See the link I provided for info about why you need to use two % only in a batch file. The coffee if the letter G is simply to avoid other letters that have other uses.
– Twisty Impersonator
Jan 7 at 12:32
See the link I provided for info about why you need to use two % only in a batch file. The coffee if the letter G is simply to avoid other letters that have other uses.
– Twisty Impersonator
Jan 7 at 12:32
Thanks a lot, man. Really nice. I was trying this for day and I didn't know about. I found about it right here: ss64.com/nt/syntax-args.html
– G. L.
Jan 7 at 12:34
Thanks a lot, man. Really nice. I was trying this for day and I didn't know about. I found about it right here: ss64.com/nt/syntax-args.html
– G. L.
Jan 7 at 12:34
|
show 5 more comments
G. L. is a new contributor. Be nice, and check out our Code of Conduct.
G. L. is a new contributor. Be nice, and check out our Code of Conduct.
G. L. is a new contributor. Be nice, and check out our Code of Conduct.
G. L. is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1391469%2fi-want-to-add-cover-art-to-all-the-mkvs-in-a-folder%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown