Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Why doesn't this work?

  • 05-12-2001 7:09pm
    #1
    Registered Users, Registered Users 2 Posts: 21,264 ✭✭✭✭


    for %x in (.\*.jar) do set CLASSPATH=%CLASSPATH%;%x

    I do know in a bat file I'm supposed to have %%x. Bugging me. Is there any way to do this without having to call to an external bat file to set the classpath?


Comments

  • Registered Users, Registered Users 2 Posts: 1,481 ✭✭✭satchmo


    Ah the joys of DOS batch programming. As far as I can remember I think environment variables are only updated when the batch file exits, so your way will only store the last .jar file in CLASSPATH. If you want to do this without having to have 2 batch files, this should do the trick (make sure it's called 'setclass.bat'):
    @echo off
    if not "%1"=="" goto param
    for %%x in (.\*.jar) do call setclass %%x
    goto end
    :param
    set CLASSPATH=%CLASSPATH%;%1
    :end
    


  • Registered Users, Registered Users 2 Posts: 1,481 ✭✭✭satchmo


    Hah - as you may have guessed, that line should read ':param'


  • Registered Users, Registered Users 2 Posts: 2,660 ✭✭✭Baz_


    lol @ :param


  • Registered Users, Registered Users 2 Posts: 21,264 ✭✭✭✭Hobbes


    I think this will work in NT/2000. Not going to bother changing though as I'm trying to be able to run it across different Win flavours.
    @echo off
    if not "%1"=="" goto param
    for %%x in (.\*.jar) do call :param %%x
    goto end
    
    :param
    set CLASSPATH=%CLASSPATH%;%1
    goto end
    
    :end
    


Advertisement