I'm creating PS script to remove a bunch of applications from lots of devices.
The theory with the code below being it passes the path of an application to cmd.exe along with the "RD" (remove directory) command and two switches.
However all i get when running this is..
"'rd C:\Program Files\Mozilla Firefox /s /q' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Any suggestions please as to how accomplish my goal here
if ($app_path) {
write-host "Now Removing $appname ,install directory ($app_path)"
$command = "rd $app_path /s /q"
& cmd.exe /c $command
}
cmd.exetoRemoveDirectories? PowerShell can for instanceRemove-Item –Path $app_path –Recurse.