Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Batch File woes

Name: Anonymous 2009-04-12 10:24

@echo off
setlocal enabledelayedexpansion

:::::::::::::::::::::::::::::::::::::::::::::::::
:: This is a section of something I'm doing in batch
:: (in b4 "use a real language)
::
:: The first part works, but the second part doesn't quite work.
:: It's displaying the variable names, rather than the values.
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::






::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: This first part, I know it works. It sets a buncha variables,
:: from {1,1}, to {9,9}, to be "#".
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

for /L %%y IN (1,1,9) do (
     for /L %%x IN (1,1,9) do (
          set {%%x,%%y}=#
     )
)



:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: The upcoming second part should be equivalent to:
::
:: set row9=%{1,9}%%{2,9}%%{3,9}%%{4,9}%%{5,9}%%{6,9}%%{7,9}%%{8,9}%%{9,9}%
:: set row9=%{1,8}%%{2,8}%%{3,8}%%{4,8}%%{5,8}%%{6,8}%%{7,8}%%{8,8}%%{9,8}%
:: set row7=%{1,7}%%{2,7}%%{3,7}%%{4,7}%%{5,7}%%{6,7}%%{7,7}%%{8,7}%%{9,7}%
:: set row6=%{1,6}%%{2,6}%%{3,6}%%{4,6}%%{5,6}%%{6,6}%%{7,6}%%{8,6}%%{9,6}%
:: set row5=%{1,5}%%{2,5}%%{3,5}%%{4,5}%%{5,5}%%{6,5}%%{7,5}%%{8,5}%%{9,5}%
:: set row4=%{1,4}%%{2,4}%%{3,4}%%{4,4}%%{5,4}%%{6,4}%%{7,4}%%{8,4}%%{9,4}%
:: set row3=%{1,3}%%{2,3}%%{3,3}%%{4,3}%%{5,3}%%{6,3}%%{7,3}%%{8,3}%%{9,3}%
:: set row2=%{1,2}%%{2,2}%%{3,2}%%{4,2}%%{5,2}%%{6,2}%%{7,2}%%{8,2}%%{9,2}%
:: set row1=%{1,1}%%{2,1}%%{3,1}%%{4,1}%%{5,1}%%{6,1}%%{7,1}%%{8,1}%%{9,1}%
::
:: echo %row5%
:: echo %row4%
:: echo %row3%
:: echo %row2%
:: echo %row1%
::
::
::
:: But obviously, that's a pain in the ass to write out.
:: It uses  simple sequences of numbers, so there should be
:: some elegant solution, that would also work for a larger grid.
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


for /L %%y IN (9,-1,1) do (
     (for /L %%x IN (1,1,9) do (
          set tempcoords={%%x,%%y}) && (
          set rowtemp=!rowtemp!!tempcoords!
     )) && (echo !rowtemp!) && (set rowtemp=)
)

::::::::::::::::::::::::::::::::::::::::::::
:: Now, I can't just wrap {%%x,%%y} in percentage signs, as it
:: contains percentage signs already, and it'd read it as 3 vars -
:: %{% , %x,% , and %y}% .
::
:: Any ideas?
::::::::::::::::::::::::::::::::::::::::::::

pause

Name: Anonymous 2009-04-12 10:37

use a real language

Name: Anonymous 2009-04-12 10:39

>>2
Your worthwhile contribution to this thread is appreciated.

Name: sage 2009-04-12 10:41

use a real operating system

Name: Anonymous 2009-04-12 10:42

>>4
Suppose I should've seen that one coming too.

Name: Anonymous 2009-04-12 10:52

Why exactly can't you use a real language? Real languages are preferable for such tasks. If you need to do something which is easier to do in batch for you, what exactly is that something?

Name: Anonymous 2009-04-12 10:57

Ask a fictional website

Name: Anonymous 2009-04-12 13:01

Use bash shell.

Name: Anonymous 2009-04-12 14:15

Man punches self in balls, asks for advice, acts offended when people advise him not to punch self in balls.

Name: Anonymous 2009-04-12 17:56

>>8
sage for the idea that Linux bash is somehow so much better than Windows batch that it would be suggested as an alternative

Name: Anonymous 2009-04-12 19:16

>>10
Back to /b/ please and lrn2sage.

Name: Anonymous 2009-04-12 22:19

>>10
sage for the idea that there is such a thing as ‘‘Linux bash’’, or that cmd is remotely comparable to a real shell.

Name: Anonymous 2009-04-12 23:11

Solaris bash > FreeBSD bash > Darwin bash > Linux bash

Name: Anonymous 2009-08-16 22:49

Lain.

Name: Anonymous 2010-11-25 7:39

Name: Anonymous 2010-12-06 9:16

Back to /b/, ``GNAA Faggot''

Don't change these.
Name: Email:
Entire Thread Thread List