How can I shortcut an expression who's repeating?











up vote
0
down vote

favorite












I need help to know if can i use #definie for commands in batch or anything else like shortcuts
for example i have del "C:Games" so i definie "C:Games" as {output}



so I wrote:



@echo off   
#Definie output "C:Games"
Del "{output}"


But it didn't work for me
my problem is, when i create a script, many things are repeating and sometimes i get error
this is a part of the script



https://i.stack.imgur.com/4q0j8.png



as u can see in the pic, the yellow is repeating many times
can u suggest me a shortcut, i mean like i difinie the yellow as {output} and i write the yellow just one time
and then i replace all the yellows with {output}



This is what I've tried later in another exemple



@echo off

From=[C:UsersEasynote-TE69HWDesktopEctended fromtoFrom]

del /f /q from









share|improve this question




















  • 1




    Open a command prompt window, enter set /? and read the usage information.
    – Compo
    Nov 19 at 17:04










  • Once you've followed the above advice, please repeat the process for both del /? and rd /?, since one deletes files and the other removes directories.
    – Compo
    Nov 19 at 17:54












  • Oh thnank's that worked but the folders inside cannot b deleted only files
    – Omar Mejdi
    Nov 20 at 14:05










  • if you read my previous comment, you'd note that one Deletes files and the other, Removes Directories. If you want further assistance, please edit your question, to include the code you've now written, complete with an explanation of what happens which differs from your intent.
    – Compo
    Nov 20 at 15:35










  • Yes i saw what did u say about rd but i did not how should i put it, please check the end of the question above to see what did i write, thank's.
    – Omar Mejdi
    Nov 21 at 13:42

















up vote
0
down vote

favorite












I need help to know if can i use #definie for commands in batch or anything else like shortcuts
for example i have del "C:Games" so i definie "C:Games" as {output}



so I wrote:



@echo off   
#Definie output "C:Games"
Del "{output}"


But it didn't work for me
my problem is, when i create a script, many things are repeating and sometimes i get error
this is a part of the script



https://i.stack.imgur.com/4q0j8.png



as u can see in the pic, the yellow is repeating many times
can u suggest me a shortcut, i mean like i difinie the yellow as {output} and i write the yellow just one time
and then i replace all the yellows with {output}



This is what I've tried later in another exemple



@echo off

From=[C:UsersEasynote-TE69HWDesktopEctended fromtoFrom]

del /f /q from









share|improve this question




















  • 1




    Open a command prompt window, enter set /? and read the usage information.
    – Compo
    Nov 19 at 17:04










  • Once you've followed the above advice, please repeat the process for both del /? and rd /?, since one deletes files and the other removes directories.
    – Compo
    Nov 19 at 17:54












  • Oh thnank's that worked but the folders inside cannot b deleted only files
    – Omar Mejdi
    Nov 20 at 14:05










  • if you read my previous comment, you'd note that one Deletes files and the other, Removes Directories. If you want further assistance, please edit your question, to include the code you've now written, complete with an explanation of what happens which differs from your intent.
    – Compo
    Nov 20 at 15:35










  • Yes i saw what did u say about rd but i did not how should i put it, please check the end of the question above to see what did i write, thank's.
    – Omar Mejdi
    Nov 21 at 13:42















up vote
0
down vote

favorite









up vote
0
down vote

favorite











I need help to know if can i use #definie for commands in batch or anything else like shortcuts
for example i have del "C:Games" so i definie "C:Games" as {output}



so I wrote:



@echo off   
#Definie output "C:Games"
Del "{output}"


But it didn't work for me
my problem is, when i create a script, many things are repeating and sometimes i get error
this is a part of the script



https://i.stack.imgur.com/4q0j8.png



as u can see in the pic, the yellow is repeating many times
can u suggest me a shortcut, i mean like i difinie the yellow as {output} and i write the yellow just one time
and then i replace all the yellows with {output}



This is what I've tried later in another exemple



@echo off

From=[C:UsersEasynote-TE69HWDesktopEctended fromtoFrom]

del /f /q from









share|improve this question















I need help to know if can i use #definie for commands in batch or anything else like shortcuts
for example i have del "C:Games" so i definie "C:Games" as {output}



so I wrote:



@echo off   
#Definie output "C:Games"
Del "{output}"


But it didn't work for me
my problem is, when i create a script, many things are repeating and sometimes i get error
this is a part of the script



https://i.stack.imgur.com/4q0j8.png



as u can see in the pic, the yellow is repeating many times
can u suggest me a shortcut, i mean like i difinie the yellow as {output} and i write the yellow just one time
and then i replace all the yellows with {output}



This is what I've tried later in another exemple



@echo off

From=[C:UsersEasynote-TE69HWDesktopEctended fromtoFrom]

del /f /q from






batch-file file-io






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 at 13:39

























asked Nov 19 at 16:55









Omar Mejdi

11




11








  • 1




    Open a command prompt window, enter set /? and read the usage information.
    – Compo
    Nov 19 at 17:04










  • Once you've followed the above advice, please repeat the process for both del /? and rd /?, since one deletes files and the other removes directories.
    – Compo
    Nov 19 at 17:54












  • Oh thnank's that worked but the folders inside cannot b deleted only files
    – Omar Mejdi
    Nov 20 at 14:05










  • if you read my previous comment, you'd note that one Deletes files and the other, Removes Directories. If you want further assistance, please edit your question, to include the code you've now written, complete with an explanation of what happens which differs from your intent.
    – Compo
    Nov 20 at 15:35










  • Yes i saw what did u say about rd but i did not how should i put it, please check the end of the question above to see what did i write, thank's.
    – Omar Mejdi
    Nov 21 at 13:42
















  • 1




    Open a command prompt window, enter set /? and read the usage information.
    – Compo
    Nov 19 at 17:04










  • Once you've followed the above advice, please repeat the process for both del /? and rd /?, since one deletes files and the other removes directories.
    – Compo
    Nov 19 at 17:54












  • Oh thnank's that worked but the folders inside cannot b deleted only files
    – Omar Mejdi
    Nov 20 at 14:05










  • if you read my previous comment, you'd note that one Deletes files and the other, Removes Directories. If you want further assistance, please edit your question, to include the code you've now written, complete with an explanation of what happens which differs from your intent.
    – Compo
    Nov 20 at 15:35










  • Yes i saw what did u say about rd but i did not how should i put it, please check the end of the question above to see what did i write, thank's.
    – Omar Mejdi
    Nov 21 at 13:42










1




1




Open a command prompt window, enter set /? and read the usage information.
– Compo
Nov 19 at 17:04




Open a command prompt window, enter set /? and read the usage information.
– Compo
Nov 19 at 17:04












Once you've followed the above advice, please repeat the process for both del /? and rd /?, since one deletes files and the other removes directories.
– Compo
Nov 19 at 17:54






Once you've followed the above advice, please repeat the process for both del /? and rd /?, since one deletes files and the other removes directories.
– Compo
Nov 19 at 17:54














Oh thnank's that worked but the folders inside cannot b deleted only files
– Omar Mejdi
Nov 20 at 14:05




Oh thnank's that worked but the folders inside cannot b deleted only files
– Omar Mejdi
Nov 20 at 14:05












if you read my previous comment, you'd note that one Deletes files and the other, Removes Directories. If you want further assistance, please edit your question, to include the code you've now written, complete with an explanation of what happens which differs from your intent.
– Compo
Nov 20 at 15:35




if you read my previous comment, you'd note that one Deletes files and the other, Removes Directories. If you want further assistance, please edit your question, to include the code you've now written, complete with an explanation of what happens which differs from your intent.
– Compo
Nov 20 at 15:35












Yes i saw what did u say about rd but i did not how should i put it, please check the end of the question above to see what did i write, thank's.
– Omar Mejdi
Nov 21 at 13:42






Yes i saw what did u say about rd but i did not how should i put it, please check the end of the question above to see what did i write, thank's.
– Omar Mejdi
Nov 21 at 13:42














1 Answer
1






active

oldest

votes

















up vote
0
down vote













@echo off
set "From=C:UsersEasynote-TE69HWDesktopEctended fromtoFrom"
rd /s /q %from%


The second line sets (defines) a variable named From. (Note: variable names are case insensitive)

the third line uses that variable (%from%) with the RD command (Remvove Directory).

The switch /s works recursive (delete all subdirectories), /q doesn't ask for confirmation.



See the helpfile for any command with the switch /? (e.g. set /? or rd /?).



Also SS64 should be extremely helpful (a complete list of possible commands and their description)






share|improve this answer





















  • Thank that helped me a lot but what i need is to delete all the folders and files inside From not the From itself
    – Omar Mejdi
    Nov 21 at 14:25










  • Is it an option to just recreate it? md "%from%"
    – Stephan
    Nov 21 at 15:22











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',
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
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53379336%2fhow-can-i-shortcut-an-expression-whos-repeating%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








up vote
0
down vote













@echo off
set "From=C:UsersEasynote-TE69HWDesktopEctended fromtoFrom"
rd /s /q %from%


The second line sets (defines) a variable named From. (Note: variable names are case insensitive)

the third line uses that variable (%from%) with the RD command (Remvove Directory).

The switch /s works recursive (delete all subdirectories), /q doesn't ask for confirmation.



See the helpfile for any command with the switch /? (e.g. set /? or rd /?).



Also SS64 should be extremely helpful (a complete list of possible commands and their description)






share|improve this answer





















  • Thank that helped me a lot but what i need is to delete all the folders and files inside From not the From itself
    – Omar Mejdi
    Nov 21 at 14:25










  • Is it an option to just recreate it? md "%from%"
    – Stephan
    Nov 21 at 15:22















up vote
0
down vote













@echo off
set "From=C:UsersEasynote-TE69HWDesktopEctended fromtoFrom"
rd /s /q %from%


The second line sets (defines) a variable named From. (Note: variable names are case insensitive)

the third line uses that variable (%from%) with the RD command (Remvove Directory).

The switch /s works recursive (delete all subdirectories), /q doesn't ask for confirmation.



See the helpfile for any command with the switch /? (e.g. set /? or rd /?).



Also SS64 should be extremely helpful (a complete list of possible commands and their description)






share|improve this answer





















  • Thank that helped me a lot but what i need is to delete all the folders and files inside From not the From itself
    – Omar Mejdi
    Nov 21 at 14:25










  • Is it an option to just recreate it? md "%from%"
    – Stephan
    Nov 21 at 15:22













up vote
0
down vote










up vote
0
down vote









@echo off
set "From=C:UsersEasynote-TE69HWDesktopEctended fromtoFrom"
rd /s /q %from%


The second line sets (defines) a variable named From. (Note: variable names are case insensitive)

the third line uses that variable (%from%) with the RD command (Remvove Directory).

The switch /s works recursive (delete all subdirectories), /q doesn't ask for confirmation.



See the helpfile for any command with the switch /? (e.g. set /? or rd /?).



Also SS64 should be extremely helpful (a complete list of possible commands and their description)






share|improve this answer












@echo off
set "From=C:UsersEasynote-TE69HWDesktopEctended fromtoFrom"
rd /s /q %from%


The second line sets (defines) a variable named From. (Note: variable names are case insensitive)

the third line uses that variable (%from%) with the RD command (Remvove Directory).

The switch /s works recursive (delete all subdirectories), /q doesn't ask for confirmation.



See the helpfile for any command with the switch /? (e.g. set /? or rd /?).



Also SS64 should be extremely helpful (a complete list of possible commands and their description)







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 21 at 14:02









Stephan

34.1k43153




34.1k43153












  • Thank that helped me a lot but what i need is to delete all the folders and files inside From not the From itself
    – Omar Mejdi
    Nov 21 at 14:25










  • Is it an option to just recreate it? md "%from%"
    – Stephan
    Nov 21 at 15:22


















  • Thank that helped me a lot but what i need is to delete all the folders and files inside From not the From itself
    – Omar Mejdi
    Nov 21 at 14:25










  • Is it an option to just recreate it? md "%from%"
    – Stephan
    Nov 21 at 15:22
















Thank that helped me a lot but what i need is to delete all the folders and files inside From not the From itself
– Omar Mejdi
Nov 21 at 14:25




Thank that helped me a lot but what i need is to delete all the folders and files inside From not the From itself
– Omar Mejdi
Nov 21 at 14:25












Is it an option to just recreate it? md "%from%"
– Stephan
Nov 21 at 15:22




Is it an option to just recreate it? md "%from%"
– Stephan
Nov 21 at 15:22


















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53379336%2fhow-can-i-shortcut-an-expression-whos-repeating%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

404 Error Contact Form 7 ajax form submitting

How to know if a Active Directory user can login interactively

TypeError: fit_transform() missing 1 required positional argument: 'X'