How can I input data from a textfile into an environment variable?
I tried this but it does not work correctly:
SET version < test.txtThe textfile contains
356
19
23
44
55
23
12I would like to read in each Version number to store in a separate variable, which then can be used in Visual Source safe.
set version1 = 356
set version2 = 29
set version 3 = 73
set version 4 = 15
etc.Followed by Source safe command:
- ss pin <directory> -V%version1%Thank you for your help
Regards
Andrew Ashcroft

Hi
I don't know anything about Source Safe
but this help@echo off
setlocal EnableDelayedExpansion
set No=0
for /f %%a in (x.txt) do (
set /a No+=1
set Version!No!=%%a
)
set name
Thank you.
It now seems to store the data from the text file but I only end up with 1 variable storing the last value.
version!No! = 356Im not really familiar with Batch files but is it not possible to do IF statements to specify which variable to set?
For example within the For Loop:
IF No=1
set version 1 = %%aIF No=2
set version 2 = %%aEither that or there is alteranative syntax for Version!No! = %%aa
Thanks again
Hi
Put echo in front of the 2nd set command.
I get the listing below, what do you get.@echo off
setlocal EnableDelayedExpansion
set No=0
for /f %%a in (x.txt) do (
set /a No+=1
echo set Version!No!=%%a
)---
Output of above command
x.txt contains no's 1-10
using the command "SET"set Version1=1
set Version2=2
set Version3=3
set Version4=4
set Version5=5
set Version6=6
set Version7=7
set Version8=8
set Version9=9
set Version10=10
Hi dtech10
=====================================
If at first you don't succeed, you're about average.M2
Hi Mechanic I wrote a batch program to calculate the old file date problem, which is a simpler than my previos version.
I just need to test it, I'll post it here shortly, it's only for WinXp ect.I might try and write one for MsDos but thats a different kettle of fish.
"I might try and write one for MsDos but thats a different kettle of fish." Let the congregation say amen.
=====================================
If at first you don't succeed, you're about average.M2
