batch menu help?

Associate
Joined
8 Mar 2007
Posts
2,176
Location
between here and there
hey guys,

I have a nas with loads of system images on it.

I currently use windows AIK to create and restore them to PC's and Laptop's.

I'd like to write a batch file that starts automaticlly and scans the nas and lists all the available model number sof PC's and Laptops.

example..

on the nas the share is ''iUsers" and within is a sub directory called "Images". In the Images folder is a whole set of other folders containing the images. These folders are named based on the PC/Laptop model number from which they came from.

So I have folders called "p460", "p500", "np-10", "p300 SiS661" and so on.

What I'm stuck on, is writing a script that sees these folders and adds them to the menu as options.

so the menu should look like this..


----------------------------------------------------------------
|
| My Imaging App
|
| Please select a model...
|
| 1 - %first model number% (p460)
| 2 - %second model number% (p500)
| 3 - %third model number% (p300 sis661)
|
|

and so on...

I could hard code them in but I'm always adding new models and I'd like the script to dymanical see new model and add them to the menu list without having to edit it every time a new model is created.

I'm thinking some kind of for loop to create the varaibles needs to the menu??

any ideas??
 
Last edited:
Do you have to use a batch file? It would probably be much easier to use something like VBScript to do it.

Something like this should start you off, it gives you a list of folders in c:\temp and prompts you to choose one:
PHP:
Set subFolders = CreateObject("Scripting.Dictionary")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("C:\windows\temp")
Set colSubfolders = objFolder.Subfolders
Dim i : i =0

WScript.Echo vbCrLf & "Options: "

' Loop over all subfolders in objFolder and 'build' a menu
For Each objSubfolder in colSubfolders
	i = i +1

	subFolders.Add i-1, objSubfolder.Name
    WScript.Echo i & " - " & objSubfolder.Name	
Next

' Prompt for option
WScript.Echo vbCrLf & "Select option: "
menuChoice = WScript.StdIn.ReadLine

' Display the chosen option, you could do whatever you wanted based on the option here
WScript.Echo vbCrLf & "Chosen option: "
WScript.echo subFolders.Item(menuChoice-1)


WScript.Sleep(60000)

Stick it in a file called say folders.vbs and double click it (or run it from the command prompt or batch file).

http://www.activexperts.com/activmonitor/windowsmanagement/scripts/storage/folders/
 
Back
Top Bottom