Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Ok, how do I have a script that lists all the folders within its directory? Then have a question asking with directory the user wants to open.. when they open the folder, have the batch script CALL another .bat script entitled files.bat that is in each directory.
THANKS SO MUCH!

:: ===== whichDIR
@echo offif not %1'==' goto :process
dir/ad/b
echo which directory?
set /p dirCHOICE=
%0 %dirCHOICE%
goto :eof:process
cd %dirCHOICE%
call files.bat
:: === DONE
If at first you don't succeed, you're about average.M2

first how do I get it to list the numbers infront of the directories?
second, how do I get the numbers represent the directory names?
so if I have two dirs:
1. Directroy One
2. Directory TwoWhat directory?
1_
and then it would open 'Directory One'.thanks again everyone!

Never mind that, this question is more important...
Whats wrong with this statement? (root\subdir\files.bat) roob.bat is located in root\
:: Files.bat
@Echo off
Echo Return to installation menu? 'y' or 'n'
Set /p returnDIR=if "%returnDIR%"=="y" (
set returnDIR=
CD ..
Call root.bat
pause
)
if "%returnDIR%"=="n" (
set returnDIR=
Exit
)

As far I can tell Justin wants to emulate the functions of Windows Explorer which seems a bit of a pointless exercises to me.
If a folder is added or deleted, a new batch file will have to be created to accommodate it unless you use recursive programming which I don't believe you can do with batch files.
Whats wrong with this statement? (root\subdir\files.bat) roob.bat is located in root\
Whats wrong is that there is no such folder with the name root. The root folder is indicated by a single backslash or the leading backslash in a path name. A full path name is alway preceded with a back slash or a drive letter followed by a back slash. The absence of a drive letter indicates the current drive.
\subdir\files.bat means the file in the folder subdir that is in the first level of the root folder.
Stuart

Hi StuartS,
Yeah, hard to tell whether he means "the root" or a directory named "root".
And I'm not clear whether the latest question is an enhancement of the original [to provide 'return to start dir'] or a completely separate issue.
If at first you don't succeed, you're about average.M2

it was hypothetical. I have found out the problem, it was the fact I typed CD ..
since the folder I am writing these scripts on are C:\folder\folder\folder\root\ that is the root folder for the scripts. subdir is where a second part of the script asking the user if he would like to return to the menu script. The fact that the first one CALLed the second, the Dir is still at C:\folder\folder\folder\root\ not C:\folder\folder\folder\root\subdir where the second part of the script is located.
So with CD .. in place, it was really making the dir C:\folder\folder\folder\ and thats why CALL root.bat or Start root.bat would not work.
I thank you all again very much. Have a nice day!

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |