Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: store a file in a variable  (Read 2860 times)

0 Members and 1 Guest are viewing this topic.

fillycream

  • Guest
store a file in a variable
« on: August 29, 2007, 03:38:29 PM »
I want to store a file that has just one number in it, in a variable. How can I do that.

This is what I have:

set var = < changelist.txt
echo The variable is "%var%"



diablo416

  • Guest
Re: store a file in a variable
« Reply #1 on: August 29, 2007, 04:28:31 PM »
if you mean you want to store the number inside it as a variable , try this

FOR /F "tokens=1*" %%a in (yourfile.txt) do set var=%%a

^the above works in a batch file

FOR /F "tokens=1*" %a in (yourfile.txt) do set var=%a/b]

^the above works at the line

fillycream

  • Guest
Re: store a file in a variable
« Reply #2 on: August 29, 2007, 04:37:35 PM »
thank you

DeltaSlaya



    Apprentice
  • Google
    Re: store a file in a variable
    « Reply #3 on: August 29, 2007, 10:14:32 PM »
    Or,

    Quote
    set /p var=<"filename.txt"
    System specs:
    Intel Core 2 Duo E6600 (up to 3.3 stock V and air)
    ASUS Striker Extreme
    XFX 8600GT XXX Edition
    2x 1gB Corsair XMS2 DDR2-800
    Seagate Barracuda 320gB SATA
    Raidmax Ninja 918 (520W ATXV2.0 PSU)
    -