Computing.Net > Forums > Programming > Variable from a file?

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

Variable from a file?

Reply to Message Icon

Original Message
Name: Mathieu Gendreau
Date: July 31, 2005 at 18:46:22 Pacific
Subject: Variable from a file?
OS: Windows 98SE
CPU/Ram: not needed
Comment:

Hello everybody,
Let me explain my question, I have 2 batch file, the first one create a file with a value in it and the second need to set a variable using the value given in the file.

set variable=<myvariable.txt didn't work.

Sincerly yours,
Mathieu Gendreau


Report Offensive Message For Removal


Response Number 1
Name: Mechanix2Go
Date: August 1, 2005 at 03:53:02 Pacific
Reply: (edit)

Hi,

"set variable=<myvariable.txt didn't work"

You're right; that won't work.

Neither will this:
set /p variable=<myvariable.txt

Try this:

::== my.bat
@echo off
echo set myvar=mystring > setMYvar.bat
setMYvar
::==

M2


If at first you don't succeed, you're about average.


Report Offensive Follow Up For Removal

Response Number 2
Name: Mathieu Gendreau
Date: August 1, 2005 at 16:48:30 Pacific
Reply: (edit)

Hello mechanix2go,
Thank you for this script, it worked like a charm.


Report Offensive Follow Up For Removal







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








Do you have your own blog?

Yes
No
I did before
I will soon


View Results

Poll Finishes In 4 Days.
Discuss in The Lounge
Poll History




Data Recovery Software