1.

Solve : Variable in a variable?

Answer»

Hi ppl, I just joined the forum because I'm a bit stuck. I'm running Win Vista Home Premium (I know it's lame :/) and I thought to make something like a quick file browser, I have made most of it but what I want to be able to do is allow the user to go to complex folder trees without me having to write a couple of lines for each sub-folder.

I had an idea (not complete) and it looks like this:
ECHO Go down a level?
ECHO 1=Yes 2=No 3=Exit
@Echo off
CHOICE /N /C:123 %1
IF ERRORLEVEL ==3 GOTO Exit
IF ERRORLEVEL ==2 GOTO NOSUB3
IF ERRORLEVEL ==1 GOTO SUBINF
:NOSUB3
start %var1%:\%VAR2%\%var3%\%var4%
Goto BEGIN
:SUBINF
set varf=%varer%
start %var1%:\%var2%\%var3%\%var4%\%var%varf%%

Th problem occurs with the last line of variables, I need to know how to modify a variable by adding another variable inside it, OR I need a better solution than 2 variables...

Thx in advance MeitneriumBTW, sorry for my bad POST, this is just a fragment of my work not all of commands Quote from: Meitnerium on MAY 12, 2010, 11:36:10 AM

Quick file browser.


C:\test>type meit2.bat
Code: [SELECT]@echo off

dir /B /s *.txt

echo bye
Output:

C:\test>meit2.bat
C:\test\5810.txt
C:\test\BATCH116-20100508-1701.txt
C:\test\compare.txt
C:\test\count.txt
C:\test\count2.txt
C:\test\DATA256.txt
C:\test\folderlog.txt
C:\test\nc.txt
C:\test\old15.txt
C:\test\old15days.txt
C:\test\seq.txt
C:\test\test.txt
C:\test\timefile1.txt
C:\test\timefile2.txt
C:\test\timefile3.txt
C:\test\timefile4.txt
C:\test\today.txt
C:\test\var.txt
C:\test\ver6.txt
C:\test\folderA\a.txt
C:\test\folderA\b.txt
C:\test\folderA\c.txt
C:\test\folderB\a.txt
C:\test\folderB\c.txt
C:\test\space name\test.txt
bye
C:\test>Wow, thaks... It's quiet impressive however I wanted to keep all stuff in 1 file.... anyway thanks for that
I wish you good luck and thanks againQuote from: Meitnerium on May 13, 2010, 02:02:59 PM
I wanted to keep all stuff in 1 file....


C:\test>type meit2.bat
Code: [Select]@echo off

dir /B /s *.txt > onefile.txt

type onefile.txt
Output:

C:\test>meit2.bat
C:\test\5810.txt
C:\test\BATCH116-20100508-1701.txt
C:\test\compare.txt
C:\test\count.txt
C:\test\count2.txt
C:\test\DATA256.txt
C:\test\folderlog.txt
C:\test\nc.txt
C:\test\old15.txt
C:\test\old15days.txt
C:\test\onefile.txt
C:\test\seq.txt
C:\test\test.txt
C:\test\timefile1.txt
C:\test\timefile2.txt
C:\test\timefile3.txt
C:\test\timefile4.txt
C:\test\today.txt
C:\test\var.txt
C:\test\ver6.txt
C:\test\folderA\a.txt
C:\test\folderA\b.txt
C:\test\folderA\c.txt
C:\test\folderB\a.txt
C:\test\folderB\c.txt
C:\test\space name\test.txt
C:\test>


Discussion

No Comment Found