Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
I want to store variables in a temp file and to be able to call those variables for usage in the batch file.Im not sure how to manipulate the FOR command for this. I want to be able to store variables in that temp file and also I want to be able to search the temp file for the variable.
My plan for the temp file is as follows:
------
VARIABLES:
INT1: VAR1
INT2: VAR2
CHAR1: VAR3
CHAR2: VAR4
------
Any help regardless of the FOR command usage would be greatly appreciated.
Thanx for you help :)

I noticed you are using int and char datatypes. Batch scripts do not use special datatypes and are not defined in the script.
"Computer security." — Oxymoron

Thanx for your comments tonysathre,
The datatypes are only for my reference. When i create a local variable within a batch script i like to be as discriptive as possible. It just lets me know what the variable is used for throughout the script.

Is your goal to set, for instance:
INT1=VAR1
?
=====================================
If at first you don't succeed, you're about average.M2

Mechanix2Go,
A better example than the one above would be:
---%temp%\~atempfile.tmp
VARIABLES
Date=%date%
Time=%time%
Name=%stringName%
---
I want to store variables, from batch file execution, into a temp file and call those variables back into the batch file when requested.
Im having trouble putting the variables where I would like them to go, for example the variables %stringName% to be placed after the Name= in the temp file.
Im also having trouble storing those variable values into "fresh" variables in the batch script.

With those lines in myfile.tmp you can:
for /f "tokens=*" %%V in (%TEMP%\myfile.tmp) do set %%V
BTW, reassigning built-in vars lije TIME and DATE is generally not a good idea.
=====================================
If at first you don't succeed, you're about average.M2

![]() |
![]() |
![]() |

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