Batch Coding - dir list & file exec
|
Original Message
|
Name: Justin B
Date: October 28, 2005 at 18:34:32 Pacific
Subject: Batch Coding - dir list & file execOS: Windows XP SP2CPU/Ram: 512 Ram - Pentium IIIV |
Comment: 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!
Report Offensive Message For Removal
|
|
Response Number 1
|
Name: StuartS
Date: October 28, 2005 at 23:42:56 Pacific
Subject: Batch Coding - dir list & file exec |
Reply: (edit)You already have an application that will do just that. Its called Windows Explorer. Stuart
Report Offensive Follow Up For Removal
|
|
Response Number 2
|
Name: Mechanix2Go
Date: October 29, 2005 at 05:44:14 Pacific
Subject: Batch Coding - dir list & file exec |
Reply: (edit):: ===== whichDIR @echo off if 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
Report Offensive Follow Up For Removal
|
|
Response Number 3
|
Name: Justin B
Date: October 30, 2005 at 18:48:42 Pacific
Subject: Batch Coding - dir list & file exec |
Reply: (edit)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 Two What directory? 1_ and then it would open 'Directory One'.
thanks again everyone!
Report Offensive Follow Up For Removal
|
|
Response Number 4
|
Name: Justin B
Date: October 30, 2005 at 20:53:05 Pacific
Subject: Batch Coding - dir list & file exec |
Reply: (edit)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 )
Report Offensive Follow Up For Removal
|
|
Response Number 5
|
Name: Mechanix2Go
Date: October 30, 2005 at 22:11:59 Pacific
Subject: Batch Coding - dir list & file exec |
Reply: (edit)I'm nopt clear on what you want to do here. If at first you don't succeed, you're about average.M2
Report Offensive Follow Up For Removal
|
|
Response Number 6
|
Name: StuartS
Date: October 30, 2005 at 22:37:37 Pacific
Subject: Batch Coding - dir list & file exec |
Reply: (edit)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
Report Offensive Follow Up For Removal
|
|
Response Number 7
|
Name: Mechanix2Go
Date: October 30, 2005 at 23:03:48 Pacific
Subject: Batch Coding - dir list & file exec |
Reply: (edit)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
Report Offensive Follow Up For Removal
|
|
Response Number 8
|
Name: Justin B
Date: October 31, 2005 at 07:29:59 Pacific
Subject: Batch Coding - dir list & file exec |
Reply: (edit)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!
Report Offensive Follow Up For Removal
|
Use following form to reply to current message: