-1

This is my function to remove the directory after uninstalling. Basically, in my .ism file, there are 2 .rul files(setup.rul and VerGetFileProperty.rul). I have added some code to clean the directory in setup.rul. I build, and one setup.exe is formed. While I run setup.exe, it will ask me to select the db, if I select a db, its says the db server is not found. But if I run the original setup, it will auto detect db server and install. How is the setup.exe getting created? I haven't made any changes on searching for db server part. I have just created a function to remove the directory while uninstalling.

function fnClean()
NUMBER nrv;
begin
if (ExistsDir (INSTALLDIR ^ "XYZ Dir") = EXISTS) then     
    SetDialogTitle(DLG_ASK_YESNO,"Delete Logs");
    nrv = AskYesNo( "Do you want to delete all log files now? Say No if you       prefer delete them later manually.", YES );
    if ( nrv ) then     
        nrv = DeleteDir (INSTALLDIR ^ "XYZ Dir", ALLCONTENTS);    
        DeleteDir (INSTALLDIR, ALLCONTENTS);
    endif;        
else
    DeleteDir (INSTALLDIR, ALLCONTENTS);  
endif;
end;
Archana
  • 99
  • 1
  • 1
  • 11
  • I want to know what the `cmd_line` exactly means **"-i" & sql_file & ">" & log_file & "2>&1"** – Archana Nov 19 '13 at 09:02
  • The last edit to this question seems to make it unanswerable... I don't think you're going to get any help as it's currently written. Read through it and keep in mind that most readers aren't going to know the backstory - be explicit on what you're trying to do, what you tried and what happened. – thekbb Nov 25 '13 at 16:40

1 Answers1

1

I assume your installer either calling some exe that is generating the log files, or the log files are generated by using whatever application you are installing.

If you are using an MSI(Windows Installer) based project, you can add the files to the RemoveFile table. You'll want to use a InstallMode of 2 (remove on uninstall)


editing to expand answer

cmd_line = "cmd /c """ & objNamedArgs.Item("SQLCMD") & """ " & objNamedArgs.Item("CONNECT") & _" -i " & sql_file & " > " & log_file & " 2>&1"

  • -i "sqlfile" is an argument to the sqlcmd program. -i means "input" and the sqlfile will be whatever is being specified, usually a .sql script.
  • logfile means: redirect output of whatever command (in this case, sqlcmd) into the file specified by logfile.

  • The 2>&1 is already answered here.
Community
  • 1
  • 1
NGaida
  • 688
  • 3
  • 10
  • You are right @NGaida. A .wsf file is written in vbscript to create these files. There is another .wsf to uninstall the files. but I don't think it is uninstalling these log files. I will paste the piece of code. See if you can help. Also want to know how to edit this .wsf file in InstallShield – Archana Nov 19 '13 at 08:58
  • 1
    So the vbscript extracts something? Or just creates the log files? Be wary of any "extra" actions that create files on the target system, you are stepping outside of the transactionality provided by the windows installer system. – NGaida Nov 20 '13 at 15:27
  • Yes it executes a .sql script and copies the answer to .log files – Archana Nov 21 '13 at 04:57
  • So if I write few statements like `Del "something.log"` at the end of the script file. will this delete those .log files while uninstalling? If yes, then how to edit the script file, compile it and make it available while installing/uninstalling? – Archana Nov 21 '13 at 05:26
  • No, if you add a "del" to your script, you'll end up deleting the log file at the end of your script; you might as well not even create one. Also: with vbscript there isn't anything to really compile. you just change the script. How you get it into your installer wouldn't change from how you do it now. For removing files on uninstall, my answer stands: use the RemoveFiles table. – NGaida Nov 21 '13 at 19:54
  • Basically, in my .ism file, there are 2 .rul files(setup.rul and VerGetFileProperty.rul). I have added some code to clean the directory in setup.rul. I build, and one setup.exe is formed. While I run setup.exe, it will ask me to select the db, if I select a db, its says the db server is not found. But if I run the original setup, it will auto detect db server and install. How is the setup.exe getting created? I haven't made any changes on searching for db server part. I have just created a function to remove the directory while uninstalling. Please check my question to see what I have tried. – Archana Nov 22 '13 at 09:04
  • I think the question you are asking now is fundamentally different from what you originally asked. I'd recommend reverting your edits to the original question, and asking a new question. – NGaida Nov 25 '13 at 16:47