1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

del /s /q /f asks Are you sure (Y/N)?

Discussion in 'Support' started by Docfxit, Mar 1, 2015.

  1. Docfxit

    Joined:
    Mar 1, 2015
    Messages:
    6
    Likes Received:
    0
    When I am trying to debug a batch script that has:
    del /s /q /f test.txt
    If I'm in the debugger it asks:
    Are you sure (Y/N)?
    If I run the script in windows 7 it doesn't ask
    The /q parm is supposed to suppress the question.

    How can I get Take Command v. 17.00.77 to not ask on a del statement?

    Thank you,

    Docfxit
     
  2. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,354
    Likes Received:
    39
    Have you tried /Y?

    I'm not really sure what /Q is for; something for CMD.EXE compatibility, I think?
     
  3. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,063
    Likes Received:
    30
    The /Q suppresses the display of filenames as they are deleted. For example, /Q suppresses the message below.
    Code:
    v:\> del test.txt
    Deleting V:\test.txt
      1 file deleted
    I tried your experiment exactly. It worked the same at the command line and in the debugger ... there was no prompt.
     
  4. Docfxit

    Joined:
    Mar 1, 2015
    Messages:
    6
    Likes Received:
    0
    I can understand it working for you. I have run this same script through the debugger many times. It went through without asking me many times also. Then all off a sudden it started asking me. Now I can't get it to stop asking.

    If you open a cmd window and type in del /? You will see the /Q option. You also will not see a /Y option in Win7.

    Thank you,
    Docfxit
     
  5. Charles G

    Joined:
    Apr 2, 2011
    Messages:
    1,035
    Likes Received:
    0
    The current CHM has for DEL / options:

    ================
    Options



    /= Display the DEL command dialog to help you set the filename and command line options. You cannot specify any other arguments on the command line.

    /A: Delete only those files that have the specified attribute(s) set. See Attribute Switches for information on the attributes which can follow /A:. Do not use /A: with @file lists. See @file lists for details.

    You can specify /A:= to display a dialog to help you set individual attributes. (Not available in TCC/LE.)


    /B If DEL can't delete the file (for example, if access is denied) it will schedule it to be deleted at the next reboot.

    /E Suppress all non-fatal error messages, such as "File Not Found." Fatal error messages, such as "Drive not ready," will still be displayed. This option is most useful in batch files and aliases.

    /F This option has the same effect as /Z (see below): it deletes read-only, hidden, and system files as well as normal files.. It is included for compatibility with CMD.

    /I"text" Select filenames by matching text in their descriptions. The text can include wildcards and extended wildcards. The search text must be enclosed in double quotes, and must follow the /I immediately, with no intervening spaces. You can select all filenames that have a description with /I"[?]*", or all filenames that do not have a description with /I"[]".

    /K Physically delete files instead of sending them to the Windows Recycle Bin.

    /L Delete symlinks instead of their contents. (Not available in TCC/LE.)

    /N Do everything except actually delete the file(s). This is useful for testing the result of a DEL.

    A /N with one or more of the following arguments has an alternate meaning:


    d Skip hidden directories (when used with /S)
    e Don't display errors
    f Don't display the bytes freed in the summary
    j Skip junctions (when used with /S)
    n Don't update the file descriptions
    s Don't display the summary
    t Don't update the CD / CDD extended directory search database (JPSTREE.IDX)

    /O:... Sort the files before processing. (Not available in TCC/LE.)

    You may use any combination of the sorting options below. If multiple options are used, the listing will be sorted with the first sort option as the primary key, the next as the secondary key, and so on:


    n Sort by filename and extension, unless e is explicitly included. This is the default.
    - Reverse the sort order for the next sort key
    a Sort names and extensions in standard ASCII order, instead of numerically when numeric substrings are included in the name or extension.
    d Sort by date and time (oldest first); also see /T:acw
    e Sort by extension
    g Group subdirectories first, then files
    r Reverse the sort order for all options
    s Sort by size
    t Same as d
    u Unsorted

    /P Prompt the user to confirm each erasure. Your options at the prompt are explained in detail under Page and File Prompts.

    /Q Don't display filenames as they are deleted, or the number of files deleted or bytes freed. If Prompt on Wildcard Deletes is disabled then /Q also disables the normal confirmation prompt when performing wildcard deletions (e.g. DEL *), for compatibility with CMD. Use caution if you disable Prompt on Wildcard Deletes, as this will allow DEL /Q to delete an entire directory without prompting for confirmation. See also /T.

    /R Delete files to the Windows Recycle Bin.

    /S Delete the specified files in this directory and all of its subdirectories. This is like a GLOBAL DEL, and can be used to delete all the files in a subdirectory tree or even a whole disk. Do not use /S with @file lists. See @file lists for details.

    If you specify a number after the /S, DEL will limit the subdirectory recursion to that number. For example, if you have a directory tree "\a\b\c\d\e", /S2 will only affect the "a", "b", and "c" directories.


    If you specify a + followed by a number after the /S, DEL will not delete any files until it gets to that depth in the subdirectory tree. For example, if you have a directory tree \a\b\c\d\e, /S+2 will not delete anything in \a or \a\b. (Not available in TCC/LE.)


    /T Don't display filenames as they are deleted, but display the total number of files deleted plus the amount of free disk space recovered.

    /W[n] Overwrite the file contents using the DoD 5220.22-M (E) standard for secure deletion. (This overwrites every byte in the file with different values). You can optionally specify the number of passes (1-999); the default is 3. See also DelWipePasses. Use this option to completely obliterate a file's contents from your disk. Once you have used this option it is impossible to recover the file even if you are using an undelete utility, because the contents of the file are destroyed before it is deleted. /W will override a /R.

    /X Removes empty subdirectories (only useful when used with /S). If DEL deletes one or more directories, they will be removed automatically from the extended directory search database. DEL will display the directories being removed (with a trailing \).

    /Y The reverse of /P . It assumes a Y response to everything, including deleting an entire subdirectory tree. TCC normally prompts before deleting files when the name consists only of wildcards or a subdirectory name (see above); /Y overrides this protection and should be used with extreme caution!

    /Z Delete read-only, hidden, and system files as well as normal files. Files with the read-only, hidden, or system attribute set are normally protected from deletion; /Z overrides this protection, and should be used with caution. Because EXCEPT works by hiding files, /Z will override an EXCEPT command. However, files specified in a file exclusion range will not be deleted by DEL /Z.

    For example, to delete the entire subdirectory tree starting with C:\UTIL, including hidden and read- only files, without prompting (use this command with CAUTION!):


    del /s /x /y /z c:\util\


    ================
     
  6. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    10,027
    Likes Received:
    84
    Not reproducible here.

    /Q has nothing to do with your particular syntax; it's only relevant when you use global wildcards.

    I suspect you have an alias for DEL that's inserting the /P option.
     
  7. Docfxit

    Joined:
    Mar 1, 2015
    Messages:
    6
    Likes Received:
    0
    In Win7 sp1 32bit
    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
    you only the files that are deleted, not the ones it could not find.

    When a /Q is not used the Del cmd asks "Are you sure (Y/N)?"

    When the /Q is used the Del cmd doesn't ask and automatically uses a "Y" for the answer.
    When I run this in a CMD window it doesn't ask "Are you sure (Y/N)?"
    When I run the same line in Take Command it does ask "Are you sure (Y/N)?"

    Take Command is not applying the /Q in the same manner as Win7 CMD.

    Thanks,

    Docfxit
     
  8. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    10,027
    Likes Received:
    84
    TCC doesn't invert the meaning of command options based on the (non-existent in TCC) Command Extensions value.

    If you want DEL /Q in TCC to behave the same as the (inverted by Command Extensions) /Q in CMD, uncheck "Prompt on Wildcard Deletes" in OPTION / Startup. See HELP DEL for details.
     

Share This Page