[MSH] "Are you sure you want to continue?"

Discussion in 'Scripting' started by Dominik, Jan 22, 2006.

  1. Dominik

    Dominik Guest

    hi,
    i wrote a script which deletes some files/folders:

    ....
    remove-item $item.fullname -force -errorvariable +err
    ....

    but when i run this script sometimes this message pops up:

    Confirm
    The item at ... has children and the -recurse parameter was not
    specified. If you continue, all children will be removed with the item.
    Are you sure you want to continue?
    [Y] Yes [A] Yes to All [N] No [L] No to All Suspend [?] Help
    (default is "Y"):

    how do i avoid this message?
    the default action should be "No to all"
     
    Dominik, Jan 22, 2006
    #1
    1. Advertisements


  2. you can set -Recurse $false,

    remove-item $item.fullname -force -Recurse $false

    so you wont get asked.

    gr /\/\o\/\/
     
    /\\/\\o\\/\\/ [MVP], Jan 22, 2006
    #2
    1. Advertisements

  3. Dominik

    Dominik Guest

    obvious... thanks :)
     
    Dominik, Jan 23, 2006
    #3
  4. This is a known issue that should be fixed for the next release.
    Specifying -Force in the future should avoid the check that presents the
    prompt.
     
    Jeff Jones [MSFT], Jan 23, 2006
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.