Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
BATCH using variables
Name: JordanVash Date: August 2, 2007 at 04:49:48 Pacific OS: xp CPU/Ram: 2gb
Comment:
I want to be able to use variables to dos commands from a file.
What i need is something like %d%, and when it comes to it in a batch file. It will display whatever is in that text.
Sort of like copy name.text con > nul, BUT i want to use variables to make text show up into the dos prompt from the file.
Name: Mechanix2Go Date: August 2, 2007 at 05:25:08 Pacific
Reply:
Like this?
==================== @echo off setLocal EnableDelayedExpansion
set d=name.text copy %d% con > nul
===================================== If at first you don't succeed, you're about average.
M2
0
Response Number 2
Name: JordanVash Date: August 2, 2007 at 05:50:18 Pacific
Reply:
I think that is, but where did you get
setLocal EnableDelayedExpansion
ive never heard of that
0
Response Number 3
Name: JordanVash Date: August 2, 2007 at 05:53:53 Pacific
Reply:
That just displays whats in the text. I mean i want it to RUN and show up. Im trying to make a little virus scanner that picks up basic viruses like the i love you and all that. I got the basis of it but! For the actual scan, I need it to display on screen.
Say if the virus was like dd.txt in system drive
It would be something like
cd %systemdrive% if exist dd.txt (VARIABLE HERE)
and when you type the variable, it will show up if you echo it into a log file that i have created. I know this may sound weird but you would have to SEE what im doing if you dont understand it by me just saying it.
0
Response Number 4
Name: Mechanix2Go Date: August 2, 2007 at 06:00:51 Pacific
Reply:
Yup, might help to see what you're doing.
===================================== If at first you don't succeed, you're about average.
M2
0
Response Number 5
Name: Mechanix2Go Date: August 2, 2007 at 06:37:40 Pacific
Reply:
re #2
cmd /?
===================================== If at first you don't succeed, you're about average.
M2
0
Response Number 6
Name: JordanVash Date: August 2, 2007 at 07:02:30 Pacific
Reply:
Well I do not wish to post my source to it here, but If you message me on aim or MSN Or even email. I will gladly show you Mechanix2Go.
AIM: Death Current X MSN: jordanvash@hotmail.com email: Jordan@vashey.com
Summary: I am developing a script using MSDOS batch files for searching for strings in a directory My requirement is as follows I have a text file with a set of labels I have to search if each label is used in...
Summary: I'm trying to make a batch file in dos, and I can't seem to get a Variable to work as my MAX in a FOR statement, here is my code: SET NumDisks = 5 FOR /L %%i IN (1, 1, %NumDisks%) DO (ECHO Test) If I ...
Summary: I need to learn how to create a batch file variable of a file or folder name to use several times later in the batch file. I've tried several ways and haven't figured out how to do it. One example tha...