Syntax problem in PowerShell in CMD environment
Under Windows 10 Enterprise LTSC, I have a simple CMD ff.bat which contains:
powershell -Command (Measure-Command {ffmpeg.exe -hide_banner -i %* E:%~n1.mkv}).ToString
In CMD> ff test.mp4
and ff "test.mp4"
works but NOT
ff "E:Serie.(2009).8x04.episode.FR.LD.WEBRip.x264-LiBERTY.[server.org.ru].mkv"
Given PowerShell error is:
Au caractère Ligne:1 : 60
+ (Measure-Command {ffmpeg.exe -hide_banner -i Serie.(2009).8x04.episode.FR.LD.WEBRip.x264-LiBERTY.[server.org.ru].mkv ...
+
~
Nom de propriété manquant après l’opérateur de référence.
(Missing property after reference operator)
Au caractère Ligne:1 : 144
+ ... .FR.LD.WEBRip.x264-LiBERTY.[server.org.ru].mp4 E:Serie ...
+ ~
Nom de propriété manquant après l’opérateur de référence.
+ CategoryInfo : ParserError: (:) , ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MissingPropertyName
I guess the problem comes from the .-():
and brackets and parenthesis characters found in the file name.
Could you give me the proper syntax for this to work in CMD, please.
As a bonus, you can give me the syntax to make it work in PS if it can.
Please note I'm a complete newbie in PowerShell and need examples more than suggestions.
Thanks in advance, Marc.
windows powershell batch-file cmd syntax
add a comment |
Under Windows 10 Enterprise LTSC, I have a simple CMD ff.bat which contains:
powershell -Command (Measure-Command {ffmpeg.exe -hide_banner -i %* E:%~n1.mkv}).ToString
In CMD> ff test.mp4
and ff "test.mp4"
works but NOT
ff "E:Serie.(2009).8x04.episode.FR.LD.WEBRip.x264-LiBERTY.[server.org.ru].mkv"
Given PowerShell error is:
Au caractère Ligne:1 : 60
+ (Measure-Command {ffmpeg.exe -hide_banner -i Serie.(2009).8x04.episode.FR.LD.WEBRip.x264-LiBERTY.[server.org.ru].mkv ...
+
~
Nom de propriété manquant après l’opérateur de référence.
(Missing property after reference operator)
Au caractère Ligne:1 : 144
+ ... .FR.LD.WEBRip.x264-LiBERTY.[server.org.ru].mp4 E:Serie ...
+ ~
Nom de propriété manquant après l’opérateur de référence.
+ CategoryInfo : ParserError: (:) , ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MissingPropertyName
I guess the problem comes from the .-():
and brackets and parenthesis characters found in the file name.
Could you give me the proper syntax for this to work in CMD, please.
As a bonus, you can give me the syntax to make it work in PS if it can.
Please note I'm a complete newbie in PowerShell and need examples more than suggestions.
Thanks in advance, Marc.
windows powershell batch-file cmd syntax
try withpowershell -Command "(Measure-Command {ffmpeg.exe -hide_banner -i %* """E:%~n1.mkv"""}).ToString"
– npocmaka
Nov 22 '18 at 10:20
@npocmaka Probem with that approach is you never know what possibly double quoted arguments are contained in%*
and break the outer double quotes.
– LotPings
Nov 22 '18 at 10:31
Possible answer stackoverflow.com/questions/45760457/…
– vrdse
Nov 22 '18 at 16:59
add a comment |
Under Windows 10 Enterprise LTSC, I have a simple CMD ff.bat which contains:
powershell -Command (Measure-Command {ffmpeg.exe -hide_banner -i %* E:%~n1.mkv}).ToString
In CMD> ff test.mp4
and ff "test.mp4"
works but NOT
ff "E:Serie.(2009).8x04.episode.FR.LD.WEBRip.x264-LiBERTY.[server.org.ru].mkv"
Given PowerShell error is:
Au caractère Ligne:1 : 60
+ (Measure-Command {ffmpeg.exe -hide_banner -i Serie.(2009).8x04.episode.FR.LD.WEBRip.x264-LiBERTY.[server.org.ru].mkv ...
+
~
Nom de propriété manquant après l’opérateur de référence.
(Missing property after reference operator)
Au caractère Ligne:1 : 144
+ ... .FR.LD.WEBRip.x264-LiBERTY.[server.org.ru].mp4 E:Serie ...
+ ~
Nom de propriété manquant après l’opérateur de référence.
+ CategoryInfo : ParserError: (:) , ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MissingPropertyName
I guess the problem comes from the .-():
and brackets and parenthesis characters found in the file name.
Could you give me the proper syntax for this to work in CMD, please.
As a bonus, you can give me the syntax to make it work in PS if it can.
Please note I'm a complete newbie in PowerShell and need examples more than suggestions.
Thanks in advance, Marc.
windows powershell batch-file cmd syntax
Under Windows 10 Enterprise LTSC, I have a simple CMD ff.bat which contains:
powershell -Command (Measure-Command {ffmpeg.exe -hide_banner -i %* E:%~n1.mkv}).ToString
In CMD> ff test.mp4
and ff "test.mp4"
works but NOT
ff "E:Serie.(2009).8x04.episode.FR.LD.WEBRip.x264-LiBERTY.[server.org.ru].mkv"
Given PowerShell error is:
Au caractère Ligne:1 : 60
+ (Measure-Command {ffmpeg.exe -hide_banner -i Serie.(2009).8x04.episode.FR.LD.WEBRip.x264-LiBERTY.[server.org.ru].mkv ...
+
~
Nom de propriété manquant après l’opérateur de référence.
(Missing property after reference operator)
Au caractère Ligne:1 : 144
+ ... .FR.LD.WEBRip.x264-LiBERTY.[server.org.ru].mp4 E:Serie ...
+ ~
Nom de propriété manquant après l’opérateur de référence.
+ CategoryInfo : ParserError: (:) , ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MissingPropertyName
I guess the problem comes from the .-():
and brackets and parenthesis characters found in the file name.
Could you give me the proper syntax for this to work in CMD, please.
As a bonus, you can give me the syntax to make it work in PS if it can.
Please note I'm a complete newbie in PowerShell and need examples more than suggestions.
Thanks in advance, Marc.
windows powershell batch-file cmd syntax
windows powershell batch-file cmd syntax
edited Nov 22 '18 at 9:37
LotPings
18.3k61532
18.3k61532
asked Nov 22 '18 at 8:12
marcurlingmarcurling
12
12
try withpowershell -Command "(Measure-Command {ffmpeg.exe -hide_banner -i %* """E:%~n1.mkv"""}).ToString"
– npocmaka
Nov 22 '18 at 10:20
@npocmaka Probem with that approach is you never know what possibly double quoted arguments are contained in%*
and break the outer double quotes.
– LotPings
Nov 22 '18 at 10:31
Possible answer stackoverflow.com/questions/45760457/…
– vrdse
Nov 22 '18 at 16:59
add a comment |
try withpowershell -Command "(Measure-Command {ffmpeg.exe -hide_banner -i %* """E:%~n1.mkv"""}).ToString"
– npocmaka
Nov 22 '18 at 10:20
@npocmaka Probem with that approach is you never know what possibly double quoted arguments are contained in%*
and break the outer double quotes.
– LotPings
Nov 22 '18 at 10:31
Possible answer stackoverflow.com/questions/45760457/…
– vrdse
Nov 22 '18 at 16:59
try with
powershell -Command "(Measure-Command {ffmpeg.exe -hide_banner -i %* """E:%~n1.mkv"""}).ToString"
– npocmaka
Nov 22 '18 at 10:20
try with
powershell -Command "(Measure-Command {ffmpeg.exe -hide_banner -i %* """E:%~n1.mkv"""}).ToString"
– npocmaka
Nov 22 '18 at 10:20
@npocmaka Probem with that approach is you never know what possibly double quoted arguments are contained in
%*
and break the outer double quotes.– LotPings
Nov 22 '18 at 10:31
@npocmaka Probem with that approach is you never know what possibly double quoted arguments are contained in
%*
and break the outer double quotes.– LotPings
Nov 22 '18 at 10:31
Possible answer stackoverflow.com/questions/45760457/…
– vrdse
Nov 22 '18 at 16:59
Possible answer stackoverflow.com/questions/45760457/…
– vrdse
Nov 22 '18 at 16:59
add a comment |
1 Answer
1
active
oldest
votes
Your assumption here...
I guess the problem comes from the .-: and brackets and parenthesis
characters found in the file name
...is correct.
There are special characters in every language use case. They can only be used as defined in the language specification. If any string you are using has these types of characters, you either need to remove them or properly terminate them.
<#
LONG DESCRIPTION
Windows PowerShell supports a set of special character sequences that
are used to represent characters that are not part of the standard
character set.
The special characters in Windows PowerShell begin with the backtick
character, also known as the grave accent (ASCII 96).
The following special characters are recognized by Windows PowerShell:
`0 Null
`a Alert
`b Backspace
`f Form feed
`n New line
`r Carriage return
`t Horizontal tab
`v Vertical tab
--% Stop parsing
#>
Get-help -Name about_Special_Characters
Even parenthesis, braces, brackets, also have special meaning, and cannot be used in file names.
PowerShell - Special Characters And Tokens
So, by what you show in that failing file name, you need to rename those.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
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
});
}
});
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%2fstackoverflow.com%2fquestions%2f53426434%2fsyntax-problem-in-powershell-in-cmd-environment%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
Your assumption here...
I guess the problem comes from the .-: and brackets and parenthesis
characters found in the file name
...is correct.
There are special characters in every language use case. They can only be used as defined in the language specification. If any string you are using has these types of characters, you either need to remove them or properly terminate them.
<#
LONG DESCRIPTION
Windows PowerShell supports a set of special character sequences that
are used to represent characters that are not part of the standard
character set.
The special characters in Windows PowerShell begin with the backtick
character, also known as the grave accent (ASCII 96).
The following special characters are recognized by Windows PowerShell:
`0 Null
`a Alert
`b Backspace
`f Form feed
`n New line
`r Carriage return
`t Horizontal tab
`v Vertical tab
--% Stop parsing
#>
Get-help -Name about_Special_Characters
Even parenthesis, braces, brackets, also have special meaning, and cannot be used in file names.
PowerShell - Special Characters And Tokens
So, by what you show in that failing file name, you need to rename those.
add a comment |
Your assumption here...
I guess the problem comes from the .-: and brackets and parenthesis
characters found in the file name
...is correct.
There are special characters in every language use case. They can only be used as defined in the language specification. If any string you are using has these types of characters, you either need to remove them or properly terminate them.
<#
LONG DESCRIPTION
Windows PowerShell supports a set of special character sequences that
are used to represent characters that are not part of the standard
character set.
The special characters in Windows PowerShell begin with the backtick
character, also known as the grave accent (ASCII 96).
The following special characters are recognized by Windows PowerShell:
`0 Null
`a Alert
`b Backspace
`f Form feed
`n New line
`r Carriage return
`t Horizontal tab
`v Vertical tab
--% Stop parsing
#>
Get-help -Name about_Special_Characters
Even parenthesis, braces, brackets, also have special meaning, and cannot be used in file names.
PowerShell - Special Characters And Tokens
So, by what you show in that failing file name, you need to rename those.
add a comment |
Your assumption here...
I guess the problem comes from the .-: and brackets and parenthesis
characters found in the file name
...is correct.
There are special characters in every language use case. They can only be used as defined in the language specification. If any string you are using has these types of characters, you either need to remove them or properly terminate them.
<#
LONG DESCRIPTION
Windows PowerShell supports a set of special character sequences that
are used to represent characters that are not part of the standard
character set.
The special characters in Windows PowerShell begin with the backtick
character, also known as the grave accent (ASCII 96).
The following special characters are recognized by Windows PowerShell:
`0 Null
`a Alert
`b Backspace
`f Form feed
`n New line
`r Carriage return
`t Horizontal tab
`v Vertical tab
--% Stop parsing
#>
Get-help -Name about_Special_Characters
Even parenthesis, braces, brackets, also have special meaning, and cannot be used in file names.
PowerShell - Special Characters And Tokens
So, by what you show in that failing file name, you need to rename those.
Your assumption here...
I guess the problem comes from the .-: and brackets and parenthesis
characters found in the file name
...is correct.
There are special characters in every language use case. They can only be used as defined in the language specification. If any string you are using has these types of characters, you either need to remove them or properly terminate them.
<#
LONG DESCRIPTION
Windows PowerShell supports a set of special character sequences that
are used to represent characters that are not part of the standard
character set.
The special characters in Windows PowerShell begin with the backtick
character, also known as the grave accent (ASCII 96).
The following special characters are recognized by Windows PowerShell:
`0 Null
`a Alert
`b Backspace
`f Form feed
`n New line
`r Carriage return
`t Horizontal tab
`v Vertical tab
--% Stop parsing
#>
Get-help -Name about_Special_Characters
Even parenthesis, braces, brackets, also have special meaning, and cannot be used in file names.
PowerShell - Special Characters And Tokens
So, by what you show in that failing file name, you need to rename those.
answered Nov 22 '18 at 8:36
postanotepostanote
3,3332410
3,3332410
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- 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%2fstackoverflow.com%2fquestions%2f53426434%2fsyntax-problem-in-powershell-in-cmd-environment%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
try with
powershell -Command "(Measure-Command {ffmpeg.exe -hide_banner -i %* """E:%~n1.mkv"""}).ToString"
– npocmaka
Nov 22 '18 at 10:20
@npocmaka Probem with that approach is you never know what possibly double quoted arguments are contained in
%*
and break the outer double quotes.– LotPings
Nov 22 '18 at 10:31
Possible answer stackoverflow.com/questions/45760457/…
– vrdse
Nov 22 '18 at 16:59