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
batch-file file-io
add a comment |
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
batch-file file-io
1
Open a command prompt window, enterset /?
and read the usage information.
– Compo
Nov 19 at 17:04
Once you've followed the above advice, please repeat the process for bothdel /?
andrd /?
, 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 oneDel
etes files and the other,R
emovesD
irectories. 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 aboutrd
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
add a comment |
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
batch-file file-io
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
batch-file file-io
edited Nov 21 at 13:39
asked Nov 19 at 16:55
Omar Mejdi
11
11
1
Open a command prompt window, enterset /?
and read the usage information.
– Compo
Nov 19 at 17:04
Once you've followed the above advice, please repeat the process for bothdel /?
andrd /?
, 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 oneDel
etes files and the other,R
emovesD
irectories. 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 aboutrd
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
add a comment |
1
Open a command prompt window, enterset /?
and read the usage information.
– Compo
Nov 19 at 17:04
Once you've followed the above advice, please repeat the process for bothdel /?
andrd /?
, 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 oneDel
etes files and the other,R
emovesD
irectories. 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 aboutrd
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
Del
etes files and the other, R
emoves D
irectories. 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
Del
etes files and the other, R
emoves D
irectories. 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
add a comment |
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)
Thank that helped me a lot but what i need is to delete all the folders and files insideFrom
not theFrom
itself
– Omar Mejdi
Nov 21 at 14:25
Is it an option to just recreate it?md "%from%"
– Stephan
Nov 21 at 15:22
add a comment |
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)
Thank that helped me a lot but what i need is to delete all the folders and files insideFrom
not theFrom
itself
– Omar Mejdi
Nov 21 at 14:25
Is it an option to just recreate it?md "%from%"
– Stephan
Nov 21 at 15:22
add a comment |
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)
Thank that helped me a lot but what i need is to delete all the folders and files insideFrom
not theFrom
itself
– Omar Mejdi
Nov 21 at 14:25
Is it an option to just recreate it?md "%from%"
– Stephan
Nov 21 at 15:22
add a comment |
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)
@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)
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 insideFrom
not theFrom
itself
– Omar Mejdi
Nov 21 at 14:25
Is it an option to just recreate it?md "%from%"
– Stephan
Nov 21 at 15:22
add a comment |
Thank that helped me a lot but what i need is to delete all the folders and files insideFrom
not theFrom
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
add a comment |
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%2f53379336%2fhow-can-i-shortcut-an-expression-whos-repeating%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
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 /?
andrd /?
, 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
Del
etes files and the other,R
emovesD
irectories. 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