I'm trying to pipe a DOS command to a file using a ShellExecute, but it doesn't create the output file. Here's the code:
var D : string; ... D := GetStartDir; ShellExecute(0,pChar('ipconfig/all > '),pchar('harbor.txt'),nil,pChar(D),SW_SHOWNORMAL); ... but no file named 'harbor.txt' gets created. Does anyone know how to fix this? Thanks, Rich Brendan Blake wrote: > ShellExecute works fine for me: (still on Delphi 5) > > ShellExecute(0,'open',PChar(filen),nil,nil,sw_ShowNormal); > > Where filen is a string containing the full path, filename and file > type/extension (.csv) You need "uses ShellAPI" (I recall). > > My default application is Excel. Works fine. Maybe you have not got the > registration correctly set up to your default application? > > Regards, > Brendan. > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On > Behalf Of Chris Stebbing > Sent: 03 July 2006 09:37 > To: Delphi List > Subject: opening a csv file in default program > > Hi All, > > I'd like to be able to launch a CSV file into Excel or whatever > happens to be the default application to handle CSV's. I had though > that I could just do a ShellEx or CreateProcess with the csv as the > application name, but that doesn't seem to work. > > Can anyone advise how I might acheve this? > > Ta muchly, > Chris. > > _______________________________________________ > Delphi mailing list -> Delphi@elists.org > http://www.elists.org/mailman/listinfo/delphi > > _______________________________________________ > Delphi mailing list -> Delphi@elists.org > http://www.elists.org/mailman/listinfo/delphi > _______________________________________________ Delphi mailing list -> Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi