|
Frist off, I need to say that I know Kix offers the "RD" command to remove directories but it has to be empty. This is the main reason I have to use the Shell command to invoke the windows version of "RD" that will remove all files, subdirs, and the directory itself! Here's the code I have a question about.
RedirectOutput("NUL") Shell "%comspec% /c rd /s /q $Directory" RedirectOutput("CON")
$Driectory is actually a directory name in my code such as "C:\yadayadayada"
When I invoke this script, I get "The system cannot find the file specified." This is normal if the directory I'm deleting doesn't exist. I was wondering if there is a way to HIDE any output given from a command that is invoked with SHELL. Here's the reasoning..
It is possible for a directory to have a file existing which means the directory is still needed by the system because the executable is running as a service. If the specific file I'm looking for does not exist however and the directory is still there, I need to delete it and anything else that is contained within it. I'm basically trying to clean up an installed program that doesn't clean up well on it's own. The uninstall will always delete the main file that runs as a service but it is possible for it to leave a directory behind with other non-necessary files still intact. So here is the code I'm trying.
IF NOT EXIST("$Directory\Executable.exe") RedirectOutput("NUL") Shell "%comspec% /c rd /s /q $Directory" RedirectOutput("CON") Else $Directory_Delete=FAILED ENDIF
|