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
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)
Please log in to answer
Posted by:
AngelD
17 years ago
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")
Have in mind that you cannot use WScript so use: Set WshShell = CreateObject("WScript.Shell")
Posted by:
AngelD
17 years ago
Posted by:
rpfenninger
17 years ago
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
And as AngelD said, I would also recommend to use the rd command.
Hope this helps
Roland
Posted by:
jamsek19
17 years ago
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
[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
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
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
Posted by:
aogilmor
17 years ago
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
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
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
Posted by:
AngelD
17 years ago
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.