I need more Information on scripting fundamentals

Posted on 2009-04-21
Last Modified: 2012-05-06

I am new to a role where I am doing some Windows scripting using .bat files.  I have done some Korn shell scripting in the past and I have some SQL scripting history as well, so I can figure most things out.  I see delete statements with a /F after the statement and  copy statements with a /Y afterward.  What do these mean here.  Also, where can I find a good fundamentals on Windows scripting ( either book or on the web )?  Is Windows scripting the same as DOS scripting?  

Question by:flscooter
    LVL 3

    Assisted Solution

    If you open a Windows command prompt and type "/?" after each command it will show you all of the switches for that command and a description.  E.g. del /? returns:

    U:\>del /?
    Deletes one or more files.

    DEL [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names
    ERASE [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names

      names         Specifies a list of one or more files or directories.
                    Wildcards may be used to delete multiple files. If a
                    directory is specified, all files within the directory
                    will be deleted.

      /P            Prompts for confirmation before deleting each file.
      /F            Force deleting of read-only files.
      /S            Delete specified files from all subdirectories.
      /Q            Quiet mode, do not ask if ok to delete on global wildcard
      /A            Selects files to delete based on attributes
      attributes    R  Read-only files            S  System files
                    H  Hidden files               A  Files ready for archiving
                    I  Not content indexed Files  L  Reparse Points
                    -  Prefix meaning not

    If Command Extensions are enabled DEL and ERASE change as follows:

    The display semantics of the /S switch are reversed in that it shows

    As you can see /F forces deteting read only files.  I hope that helps.
    LVL 28

    Accepted Solution

    Most commands can be entered at the command prompt with a "/?" after it to see the options.  For DEL /F, this forces deleting of read-only files.  For COPY /Y, this suppresses the confirmation prompt.  Try entering "DEL /?" and "COPY /?" to get the other switches.

    By far the best book that I've found has been Brian Knittel's book "Windows XP Under the Hood: Hardcore Windows Scripting and Command Line Power" from Que Publishing.  It has excellent sections on batch file programming, as well as VBScripting.

    Windows scripting is NOT the same as DOS scripting, although they are often confused.  The CMD shell (Using by newer versions of Windows) has a lot more options than the COMMAND shell (used by DOS, but still available in some versions of Windows).  They are closely related, though, which brings up the confusion.  Additionally, many people consider running command-line VBScript to be "Windows" scripting, which is another beast altogether, and VASTLY more powerful (but harder to learn foir the novice, of course).  All are handled in the book!

    Author Comment


    Thanks so much for getting back to me so quickly.  I will look up in DOS the commands and options I am interested in.  Any ideas for some basic books or good web sites with basic tutorials and good examples on Windows scripting?  I am guessing that Windows scripting is pretty much the same as DOS scripting, or is an outgrowth of it, right?


    Author Closing Comment

    I want to thank Bobsyeruncle and BillBach very much for getting back to me so promptly and with great answers.  It looks like I now have another world to explore.  All the best to both of you!


    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
    Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now