Computing.Net > Forums > Programming > BATCH using variables

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

Reply to Message Icon

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.



Sponsored Link
Ads by Google

Response Number 1
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

Related Posts

See More



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

Thanks a bunch!


0

Sponsored Link
Ads by Google
Reply to Message Icon

Checking prior dates List Databses is Visual B...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: BATCH using variables

DOS batch file to list used variabl www.computing.net/answers/programming/dos-batch-file-to-list-used-variabl/17937.html

FOR Statment, MAX using Variable www.computing.net/answers/programming/for-statment-max-using-variable/8971.html

Batch file variable creation www.computing.net/answers/programming/batch-file-variable-creation/14564.html