1.

Solve : Loading From A Different Folder.?

Answer»

Well, i have stopped the whole loading from a .TXT file, and i am now loading by seeing if the file exists. So far i have this:
Code: [Select]@echo off
if EXIST level2.txt (
set level=2
) else (
set level=1
)
if EXIST level3.txt ==if EXIST level2.txt (
set level=3
) else (
set level=1
)
if EXIST level4.txt ==if EXIST level3.txt ==if EXIST level2.txt (
set level=4
) else (
set level=1
)

echo.
echo Player Level = %level%
PAUSE >nul

Instead of having the files in the same folder as the .bat
how would i MAKE it so it read from a sub-folder like \data\level4.txt.

Any Help Appreciated.Quote from: Jacob on May 31, 2008, 03:27:58 AM

i have this:
Code: [Select]if EXIST level2.txt
how would i make it so it read from a sub-folder like \data\level4.txt.

Code: [Select]if EXIST data\level4.txtallready tried it, it doesn't work.Are you sure you are doing it properly? It works for me. Try the drive letter and full path.

Remove the first slash if the data folder is under the folder you are in when you run the batch

if EXIST data\level2.txt

Provide the full drive letter and path, with quotes if any part has spaces

if EXIST "C:\My Files\Jacob\whatever\data\level2.txt"

That should always work.

----------------------------------------

This will NEVER work.

Only 1 IF test per line! I don't know why you put == in there!

Code: [Select]if EXIST level3.txt ==if EXIST level2.txt (


Thanks Very Much, I had to do "data\" instead of "\data\"Quote from: DIAS de verano on May 31, 2008, 04:39:24 AM

This will NEVER work.

Only 1 IF test per line! I don't know why you put == in there!

Code: [Select]if EXIST level3.txt ==if EXIST level2.txt (

it does, its saying that both of them have to exist so if you want level 3 the level 2 and level 3 files have to be in there. instead of just having one level 3 file.

It seems to work and i have tested it.Quote from: Jacob on May 31, 2008, 04:50:47 AM
It seems to work and i have tested it.

Yes it does! I never knew you could do that. Sorry!
Quote from: Dias de verano on May 31, 2008, 04:57:03 AM
Quote from: Jacob on May 31, 2008, 04:50:47 AM
It seems to work and i have tested it.

Yes it does! I never knew you could do that. Sorry!

It's fine, looks like we helped each other, at first i tried && with no success i then tried == and woula!.

Thanks Again


Discussion

No Comment Found