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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Win98 DOS

Status
Not open for further replies.

deltarho

Technical User
Apr 22, 2003
36
GB
I've got a htm and a bat in the same folder. An exe is copied to the folder.

The htm has two links: One to the exe and one to the bat.
The exe creates two txt files. The bat does a litle work on them and then adds them to together.

I'd like to be able to put this folder anyway. ...(1)

Problem: bat file runs but on referencing the txt files in name only results in not found unless the folder is in a fixed location and the bat uses absolute paths.

In the bat %0 gives me the filespec. What I want is the filespec stripped of the filename so that I can use cd allowing the bat to 'pick up' the txt files.

OR another method to achieve (1)

Cheers
 
If the files and the bat are in the same folder you should not need a path in the bat, it should just find them. Or is it trying to find edit or some other system file? If it is and you will be running it on the same OS every time then put the system path in there. I.E. c:\windows\command\edit test.txt

JON
 
If only it were that simple. Running the batch file directly sees exactly as you describe.

However, when invoked from the htm link, which is a successful call, referencing sibling files without a path sees the current directory being searched first and that may have no bearing on the batch files residence. I tried this by getting the bat to run 'dir' first.

After hours of trawling DOS sites I found tucked in a topic not entirely related a solution. The answer was embedded in %0.

ie
%0%0\..

With this I can place the folder anywhere and get wherever the bat happens to be. I've tried this by moving the folder to different partitions with success.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top