I need help implementing a dos command to remove some folders from C:\documents and settings\allusers\app data

what does command do i implement as part of a custom action in Wise

0 Comments   [ - ] Hide Comments


Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
Answer this question or Comment on this question for clarity


Please do have a look at http://support.microsoft.com/kb/278411

Have in mind that you cannot use WScript so use: Set WshShell = CreateObject("WScript.Shell")
Answered 11/23/2006 by: AngelD
Red Belt

Please log in to comment
And the <Console Command> could look something like:
RD /S /Q "C:\MyFolderToRemove"
Answered 11/23/2006 by: AngelD
Red Belt

Please log in to comment
There's an article in the Altiris Knowledgebase about how to execute a dos batch file from an .MSI installation.

And as AngelD said, I would also recommend to use the rd command.

Hope this helps

Answered 11/23/2006 by: rpfenninger
Second Degree Green Belt

Please log in to comment
You should use VBScripting

[font="Courier New"]Function RemoveFolder()
Dim ShellObj_g, cmd
Set ShellObj_g = CreateObject("WScript.Shell")
cmd = "RD /S /Q " & chr(34) & & "C:\MyFolderToRemove" & chr(34)
RemoveFolder = ShellObj_g.Run( "cmd /K " & a_cmd & " & Exit", 1, True)
End Function

Mark function as Type 6 - run VBS function stored in a binary table or because is not so big Type 38 - stored in Custom action table itself.
If you use Type 6, you have to have .vbs file stored in a binary table.

Answered 11/23/2006 by: jamsek19
Orange Senior Belt

Please log in to comment
jamsek19, why are you using VBScript to call a dos function...?

If you are going to use VBScript why not use the methods in the FileSystemObject.

Option Explicit
fnFolderDelete "C:\Temp" '<-- Edit and/or repeat this line for multiple deletes
Function fnFolderDelete(sPath)
Dim objFSO : Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(sPath) Then
objFSO.DeleteFolder sPath,TRUE
End If
Set objFSO = nothing
End Function
Answered 11/23/2006 by: gmorgan618
Blue Belt

Please log in to comment
Hi cygan,
why don't you just use some entries in the 'RemoveFile' table?
See: http://msdn2.microsoft.com/en-us/library/aa371201.aspx
You can delete files (also with wildcards) and folders with it.
Regards, Nick
Answered 11/24/2006 by: nheim
Tenth Degree Black Belt

Please log in to comment
Nick, have you seen any reference to RemoveFile and read only folders? I have a package where I'm trying to remove some shortcuts and it's not working. I can't figure out whether it's because the folder is read only, or there's something else going on. I think I've had it work for r/o folders before.
Answered 11/24/2006 by: aogilmor
Ninth Degree Black Belt

Please log in to comment
thanks guys i used a batch file with the RD /S /Q "C:\MyFolderToRemove" command

custom action type : execute program from path

property : %COMSPEC

command line : "/c "c\xxxxxx\system32"\"batchfile.bat""

location : Normal Execute Immediate/deferred. After InstallValidate

condition : REMOVE= "ALL"

processing option : synchronous, ignore exit code
Answered 11/26/2006 by: cygan
Fifth Degree Brown Belt

Please log in to comment
not sure why you would bother with any of these, MSI has native functionality built into it to do just that.

check out the removefile table in the SDK for more details

The last column is of particular interest and it enforces doing during install or uninstall
Answered 11/26/2006 by: jmcfadyen
Fifth Degree Black Belt

Please log in to comment
using RemoveFiles table could be used but the msi would first have to remove all files using wild card (*) as the FileName for each directory and then last remove the folder.
Answered 11/27/2006 by: AngelD
Red Belt

Please log in to comment