none
New to Scripting - How To Use Command Line Parameter RRS feed

  • Question

  • Hello, I'm required to create a program for my scripting class. I believe I have to use a command line parameter to give a folder name so the program can list its contents (name, size, date). I have this program written from the week before, but the folder is named inside the program.We don't have a book for the class, so we are left to figure it out on our own.

    How can I change this to allow the folder to be determined in the command line?

    fn="C:\folder.name"

    Set fs = CreateObject("Scripting.FileSystemObject")

    If fs.FolderExists(fn) then

        msgbox "good folder"
        
    else

        msgbox "bad file"
        
    end if
        
    Set folder = fs.GetFolder(fn)
        
    wscript.echo "Folder Results File Created"
        
    Set files = folder.Files
        
    For Each file in files

        wscript.echo "Name: " & (file.name)
        
        wscript.echo "Size: " & (file.size)
        
        wscript.echo "Date: " & (file.datecreated)
        
    Next

    Sunday, September 23, 2018 4:54 PM

Answers

All replies