RE: Path pitfalls....
- Posted by Ray Smith <smithr at ix.net.au> Nov 25, 2002
- 465 views
Hi Patrick, Just one "kludge" suggestion ... How about coping the program (and other files) to a directory on the C drive first, then run the program from the C drive, and if need be copy any result files back to the server? Copying to the %TEMP% directory should be a good place??? It's along way from perfect, but should work. Regards, Ray Smith Patrick.Barnes at transgrid.com.au wrote: > Hmmm, I tried that. > > It doesn't want to run system() after I've changed the directory. > > On this line: > system("php.exe Cat.php > export.html", 0) > > It puts out to screen this error message: > CMD.EXE was started with '\\fp-ho1-pr\HO_Share\Tier 3 Database' as the > current directory path. UNC paths are not supported. Defaulting to > windows directory. > > What's the win32 equivalent for system? > > I tried using > shellExecute("open", "bin\\php.exe bin\\Cat.php > bin\\export.html", > SW_SHOWNORMAL) > > but apparently it won't work without a winMain call. I don't want one, > this is a script, not an application. > > ======================= > Patrick Barnes > Information Systems Group > 201 Elizabeth St, Sydney > Patrick.Barnes at tg.nsw.gov.au > Ext: 91-3583 > Ph:(02) 9284-3583 > Mob: 0410 751 044 > > > -----Original Message----- > From: Don Phillips [mailto:EuNexus at yahoo.com] > Sent: Monday, 25 November 2002 16:42 > To: EUforum > Subject: RE: Path pitfalls.... > > > > When it is run, the current directory is not that the same as where the > > file is stored, because it's being run by an Access macro. > > How can I change the current directory? > > > > I'm using win2k, but mapping network drives is not an option, because it > > > > needs to be run by other people. > > > > It won't work with absolute addressing either, because two of it's calls > > > > are to PHP scripts, and they don't like being addressed that way; it > > comes up with a CMD error. > > The script used to work when only using relative addressing ( \bin, ..\ > > > > ,etc), and running via a double click... not possible any more. > > > > Any help VERY appreciated. > > ======================= > > Patrick Barnes > > Information Systems Group > > 201 Elizabeth St, Sydney > > Patrick.Barnes at tg.nsw.gov.au > > Ext: 91-3583 > > Ph:(02) 9284-3583 > > Mob: 0410 751 044 > > This might work for you. At least I think it should. I have not tested > > this personally. In kernel32 dll is an API named SetCurrentDirectory. > It takes a pointer to a path and changes the current directory for the > current process. > > Declaration: > BOOL SetCurrentDirectory( > LPCTSTR lpPathName // address of name of new current directory > ); > > include Win32Lib.ew > > ========== > constant > SetCurrentDirectory = registerw32Procedure( > kernel32, "SetCurrentDirectoryA", {C_POINTER} ) > > atom str > str = allocate_string("\\\\fp-ho1-pr\\HO_share\\Tier 3 Database\\bin\\") > w32Proc( SetCurrentDirectory, {str} ) > free( str ) > ========== > > Don > > > *********************************************************************** > > "This electronic message and any attachments may contain privileged > and confidential information intended only for the use of the <snip> Ray Smith http://rays-web.com