Help with PowerScript Commands

Welcome Forums General PowerShell Q&A Help with PowerScript Commands

This topic contains 1 reply, has 2 voices, and was last updated by

1 year, 3 months ago.

  • Author
  • #76156

    Points: 0
    Rank: Member

    I am familiar with dos commands but powershell commands are new to me.

    I have been tasked with writing a powershell command script that does two things:

    1. Deletes the contents (all subfolders and the contents of the subfolders) under a particular folder
    2. remove a shortcut from the desktop

    if that can not be done with simple commands, maybe the steps need to be broken down:

    1. gets a list of subdirectores under a directory
    2. navigates to each of these directories and deltetes the contents
    3. remove the subdirectories
    4. then remove shortcuts from the desktop.

  • #76160

    Points: 144
    Helping Hand
    Rank: Participant

    This is almost too easy for Powershell that it is almost not worth it to learn. 😉 But if you like to do it anyway (and I would definitely recommend it) you can find some great starting points in this post: Beginner Sites and Tutorials.
    Because it is so straight forward you need in this case the same amount of cmdlets you would need in batch commands – 2.

    Remove-Item -Path 'Path to your directory containing the subfolders to delete with a following "\*"' -Recurse -Force

    ... and to remove a shortcut from the desktop ... take a guess ...

    Remove-Item -Path 'complete path to your shortcut file including the extension'

    Have fun!

The topic ‘Help with PowerScript Commands’ is closed to new replies.