/build/static/layout/Breadcrumb_cap_w.png

custom action with a dos command !!!!!!!!!

hi

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

regards

0 Comments   [ + ] Show comments

Answers (10)

Posted by: AngelD 17 years ago
Red Belt
0
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")
Posted by: AngelD 17 years ago
Red Belt
0
And the <Console Command> could look something like:
RD /S /Q "C:\MyFolderToRemove"
Posted by: rpfenninger 17 years ago
Second Degree Green Belt
0
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

Roland
Posted by: jamsek19 17 years ago
Orange Senior Belt
0
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.

Regards
Andreo
Posted by: gmorgan618 17 years ago
Blue Belt
0
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.

'<CODE>VBSCRIPT<CODE>
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
Posted by: nheim 17 years ago
10th Degree Black Belt
0
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
Posted by: aogilmor 17 years ago
9th Degree Black Belt
0
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.
Posted by: cygan 17 years ago
Fifth Degree Brown Belt
0
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
Posted by: jmcfadyen 17 years ago
5th Degree Black Belt
0
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
Posted by: AngelD 17 years ago
Red Belt
0
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.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ