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

NT Batch files

  • 07-06-2001 9:39am
    #1
    Registered Users, Registered Users 2 Posts: 4,676 ✭✭✭


    Quick question.
    How do i set a variable to a command.

    eg
    i want TEST to contain a listing of files in the current firectory.

    so %TEST% will be equal to index.html test.html blah.html

    follow ?
    any ideas ?
    Cheers,
    Gav


Comments

  • Closed Accounts Posts: 1,341 ✭✭✭Koopa


    well, if you can specify %test% to be a file on the hard disk (i dunno if you can), and do
    dir /b/l c:\ > %test%
    it might work, dunno much about NT batch file variables though so im not sure


  • Registered Users, Registered Users 2 Posts: 1,825 ✭✭✭Gambler


    Nope, you can't set it up like that.. What do you want to use the %temp% Variable for?, might be able to help you find another way round it..



  • Registered Users, Registered Users 2 Posts: 4,676 ✭✭✭Gavin


    Thanks for replies.
    I just ended up rewriting the thing.

    Works.. tis a bit klud*** though.

    ps a program called aset can be used to
    instantiate variables to command results.

    Gav


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


    You can't do it that way.

    However what exactly do you want to do with the list of files?

    You could do something like this...

    for %x in (*.*) do echo %x exists!

    (change %x to %%x if putting into a batch file).
    <font face="Verdana, Arial" size="2">Originally posted by Verb:
    Quick question.
    How do i set a variable to a command.

    eg
    i want TEST to contain a listing of files in the current firectory.

    so %TEST% will be equal to index.html test.html blah.html

    follow ?
    any ideas ?
    Cheers,
    Gav
    </font>



Advertisement