Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I substitute a file or folder that a program calls?

Status
Not open for further replies.

PHaydock

IS-IT--Management
Apr 30, 2003
17
AU
Hi
2 questions:
1) We have multi-user DOS application that in order to display reports to screen, calls up an executable called 'list' As long as list.com or list.exe is in the data folder on the server, it will use the local user's program. We trick it by renaming wordpad.exe and it runs, using the user's local Wordpad. Trouble is on some users they have a special non-MS version of Wordpad called Cetus Wordpad (much better... allows default font sizes to be changed!). But then 'list.exe' has to be one or the other... if it is really Cetus (Cwordpad.exe) renamed to list.exe and a user who doesn't have it installed tries to use it, he will get no display.
Is there a way of setting a user up (in say autoxec.nt or something) so that if list.exe is called, it substitutes wordpad.exe... and other user so that his PC runs CWordpad.exe?

2) Similarly, A windows program tries to save data in c:\ (root.) But some PCs have that set to read only, and we want it to write to C:\Contrax instead. We can't change the program at this stage (or write in parameters in a control file), and anyway different sites will have different needs. Is there a way that the OS can substitute a folder for another (i.e if request to write to c:\ write to c:\contrax instead) ?

Don't want much, do I!

________
Regards and thanks
Paul Haydock
 
problem 1: im assuming the program just calls "list" without an extension - since you said it would work if it was .com OR .exe extension - therefore you could cook up an elaborate batch file called "list.bat" in the path that could use several "if exist" statements, then call %x based on program. in other words: "if exist c:\windows\wordpad.exe then goto %1" -- and %1 could be a statement that executes wordpad.exe -- %2 could be cwordpad.exe, list.exe -- etc..

im rusty on batch files but im sure another guru can make more detailed suggestions for the batch file contents if you like the idea. it would definitely require some testing.



problem 2: you might be able to use the old DOS command SUBST which substitutes a path for a drive letter - it still exists in xp. only issue - I dont think you can SUBST "C:\folder" for "C:\" -- has to be different letters -not sure on that though. you may give that a try.

at least this gives you a possible starting point.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top