Remove quotes in Forfiles output {cmd}
So I am running this command:
FORFILES /S /M *.dmg /C "cmd /c if @fsize equ 1595694080 echo @fname"
and the output:
"058-26174-078"
but the problem is that I want the name without the quotations
like this: 058-26174-078
windows command-line cmd.exe
add a comment |
So I am running this command:
FORFILES /S /M *.dmg /C "cmd /c if @fsize equ 1595694080 echo @fname"
and the output:
"058-26174-078"
but the problem is that I want the name without the quotations
like this: 058-26174-078
windows command-line cmd.exe
add a comment |
So I am running this command:
FORFILES /S /M *.dmg /C "cmd /c if @fsize equ 1595694080 echo @fname"
and the output:
"058-26174-078"
but the problem is that I want the name without the quotations
like this: 058-26174-078
windows command-line cmd.exe
So I am running this command:
FORFILES /S /M *.dmg /C "cmd /c if @fsize equ 1595694080 echo @fname"
and the output:
"058-26174-078"
but the problem is that I want the name without the quotations
like this: 058-26174-078
windows command-line cmd.exe
windows command-line cmd.exe
edited Jan 15 '16 at 16:53
DavidPostill♦
108k27235270
108k27235270
asked Jan 15 '16 at 14:42
Hacker DudeHacker Dude
1614
1614
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
How do I remove the quotes from a variable in a cmd
shell?
You need to use ~
parameter extension together with for /f
to do this.
Use the following command:
for /f %i in ('FORFILES /S /M *.dmg /C "cmd /c if @fsize equ 1595694080 echo @fname"') do @echo %~i
To set a variable, and in a batch file, use the following command:
for /f %%i in ('FORFILES /S /M *.dmg /C "cmd /c if @fsize equ 1595694080 echo @fname"') do @set MyVariable=%%~i
Notes:
%~1
Expand%1
removing any surrounding quotes (")- In a batch file replace
%i
with%%i
and%~i
with%%~i
Further Reading
An A-Z Index of the Windows CMD command line - An excellent reference for all things Windows cmd line related.
parameters - A command line argument (or parameter) is any value passed into a batch script.
add a comment |
Use the for command, here is an example:
@echo off
FORFILES /S /M *.dmg /C "cmd /c if @fsize equ 1595694080 set quote=@fname"
for %%a in (%quote%) do set dequote=%%~a
And you can use the %dequote% variable to get the dequoted string, I may have got the syntax wrong because I have never worked with the forfiles command.
add a comment |
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
});
}
});
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%2f1026785%2fremove-quotes-in-forfiles-output-cmd%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
How do I remove the quotes from a variable in a cmd
shell?
You need to use ~
parameter extension together with for /f
to do this.
Use the following command:
for /f %i in ('FORFILES /S /M *.dmg /C "cmd /c if @fsize equ 1595694080 echo @fname"') do @echo %~i
To set a variable, and in a batch file, use the following command:
for /f %%i in ('FORFILES /S /M *.dmg /C "cmd /c if @fsize equ 1595694080 echo @fname"') do @set MyVariable=%%~i
Notes:
%~1
Expand%1
removing any surrounding quotes (")- In a batch file replace
%i
with%%i
and%~i
with%%~i
Further Reading
An A-Z Index of the Windows CMD command line - An excellent reference for all things Windows cmd line related.
parameters - A command line argument (or parameter) is any value passed into a batch script.
add a comment |
How do I remove the quotes from a variable in a cmd
shell?
You need to use ~
parameter extension together with for /f
to do this.
Use the following command:
for /f %i in ('FORFILES /S /M *.dmg /C "cmd /c if @fsize equ 1595694080 echo @fname"') do @echo %~i
To set a variable, and in a batch file, use the following command:
for /f %%i in ('FORFILES /S /M *.dmg /C "cmd /c if @fsize equ 1595694080 echo @fname"') do @set MyVariable=%%~i
Notes:
%~1
Expand%1
removing any surrounding quotes (")- In a batch file replace
%i
with%%i
and%~i
with%%~i
Further Reading
An A-Z Index of the Windows CMD command line - An excellent reference for all things Windows cmd line related.
parameters - A command line argument (or parameter) is any value passed into a batch script.
add a comment |
How do I remove the quotes from a variable in a cmd
shell?
You need to use ~
parameter extension together with for /f
to do this.
Use the following command:
for /f %i in ('FORFILES /S /M *.dmg /C "cmd /c if @fsize equ 1595694080 echo @fname"') do @echo %~i
To set a variable, and in a batch file, use the following command:
for /f %%i in ('FORFILES /S /M *.dmg /C "cmd /c if @fsize equ 1595694080 echo @fname"') do @set MyVariable=%%~i
Notes:
%~1
Expand%1
removing any surrounding quotes (")- In a batch file replace
%i
with%%i
and%~i
with%%~i
Further Reading
An A-Z Index of the Windows CMD command line - An excellent reference for all things Windows cmd line related.
parameters - A command line argument (or parameter) is any value passed into a batch script.
How do I remove the quotes from a variable in a cmd
shell?
You need to use ~
parameter extension together with for /f
to do this.
Use the following command:
for /f %i in ('FORFILES /S /M *.dmg /C "cmd /c if @fsize equ 1595694080 echo @fname"') do @echo %~i
To set a variable, and in a batch file, use the following command:
for /f %%i in ('FORFILES /S /M *.dmg /C "cmd /c if @fsize equ 1595694080 echo @fname"') do @set MyVariable=%%~i
Notes:
%~1
Expand%1
removing any surrounding quotes (")- In a batch file replace
%i
with%%i
and%~i
with%%~i
Further Reading
An A-Z Index of the Windows CMD command line - An excellent reference for all things Windows cmd line related.
parameters - A command line argument (or parameter) is any value passed into a batch script.
edited Jan 16 '16 at 20:44
answered Jan 15 '16 at 16:53
DavidPostill♦DavidPostill
108k27235270
108k27235270
add a comment |
add a comment |
Use the for command, here is an example:
@echo off
FORFILES /S /M *.dmg /C "cmd /c if @fsize equ 1595694080 set quote=@fname"
for %%a in (%quote%) do set dequote=%%~a
And you can use the %dequote% variable to get the dequoted string, I may have got the syntax wrong because I have never worked with the forfiles command.
add a comment |
Use the for command, here is an example:
@echo off
FORFILES /S /M *.dmg /C "cmd /c if @fsize equ 1595694080 set quote=@fname"
for %%a in (%quote%) do set dequote=%%~a
And you can use the %dequote% variable to get the dequoted string, I may have got the syntax wrong because I have never worked with the forfiles command.
add a comment |
Use the for command, here is an example:
@echo off
FORFILES /S /M *.dmg /C "cmd /c if @fsize equ 1595694080 set quote=@fname"
for %%a in (%quote%) do set dequote=%%~a
And you can use the %dequote% variable to get the dequoted string, I may have got the syntax wrong because I have never worked with the forfiles command.
Use the for command, here is an example:
@echo off
FORFILES /S /M *.dmg /C "cmd /c if @fsize equ 1595694080 set quote=@fname"
for %%a in (%quote%) do set dequote=%%~a
And you can use the %dequote% variable to get the dequoted string, I may have got the syntax wrong because I have never worked with the forfiles command.
answered Feb 17 at 12:57
HayzHayz
111
111
add a comment |
add a comment |
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%2f1026785%2fremove-quotes-in-forfiles-output-cmd%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