[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 246
  • Last Modified:

I need more Information on scripting fundamentals

Folks,

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?  

Thanks
0
flscooter
Asked:
flscooter
  • 2
2 Solutions
 
bobsyeruncleCommented:
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.
0
 
Bill BachPresidentCommented:
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!
0
 
flscooterAuthor Commented:
bobsyeruncle,

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?

Scott
0
 
flscooterAuthor Commented:
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!

Scott
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now