Computing.Net > Forums > Disk Operating System > Build up variables using DOS

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.

Build up variables using DOS

Reply to Message Icon

Name: fasshack (by 1234)
Date: July 12, 2005 at 13:18:40 Pacific
OS: XP Pro
CPU/Ram: 1.5GB/1GB
Comment:

Trying to build up a variable based on the contents of a directory. For Java inclined, I want to add all of the *.jar files, of a given directory, to the CLASSPATH. I tried this:

set CLP=.
for %%x in (C:\{some-dir}\*.jar) do set CLP=%%x;%CLP%

but it only counts the last iteration of the loop (i.e. the last file in the list).



Sponsored Link
Ads by Google

Response Number 1
Name: IVO
Date: July 12, 2005 at 13:50:16 Pacific
Reply:

This is not a DOS question, so you are posting on the wrong Forum; however here the solution that implues to enable the XP batch "delayed expansion of variables"

SetLocal EnableDelayedExpansion
set CLP=.
for %%x in (C:\{some-dir}\*.jar) do set CLP=%%x;!CLP!
EndLocal

Next time post on the Programming Forum


0
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: Build up variables using DOS

installing WIN98 using dos? www.computing.net/answers/dos/installing-win98-using-dos/12951.html

Need help saving hard drive info using dos commands www.computing.net/answers/dos/need-help-saving-hard-drive-info-using-dos-commands/4898.html

How to speed up a ms-dos program... www.computing.net/answers/dos/how-to-speed-up-a-msdos-program/14273.html