Search found 6 matches

by BatchEr2
05 May 2013 10:02
Forum: DOS Batch Forum
Topic: How to make .bat file open a file from any location?
Replies: 13
Views: 9957

Re: How to make .bat file open a file from any location?

Yeah, thanks, got it all working.
My friends will kill me after opening this.
by BatchEr2
05 May 2013 06:55
Forum: DOS Batch Forum
Topic: How to make .bat file open a file from any location?
Replies: 13
Views: 9957

Re: How to make .bat file open a file from any location?

You would extract the files and folders and then run the bat file, right? Yes, but if possible, no. That's what I thought - you cannot execute a batch file and have it use related files from an archive. You'd need to unzip the archive with folders, and then in the batch file you would use relative ...
by BatchEr2
05 May 2013 06:36
Forum: DOS Batch Forum
Topic: How to make .bat file open a file from any location?
Replies: 13
Views: 9957

Re: How to make .bat file open a file from any location?

Endoro wrote:

Code: Select all

for /r "%~dp0" %%i in (*.html) do echo %%~fi

Could you explain this please? Do I just replace the star with the file name?
foxidrive wrote:You would extract the files and folders and then run the bat file, right?

Yes, but if possible, no.
by BatchEr2
05 May 2013 05:05
Forum: DOS Batch Forum
Topic: How to make .bat file open a file from any location?
Replies: 13
Views: 9957

Re: How to make .bat file open a file from any location?

Well now, that works well, but how I do make it read from subfolders?
The bat is in a .zip file, with a folder with the html files etc.
by BatchEr2
04 May 2013 09:11
Forum: DOS Batch Forum
Topic: How to make .bat file open a file from any location?
Replies: 13
Views: 9957

Re: How to make .bat file open a file from any location?

The path (including the trailing backslash) where the script is located can be found in %~dp0. This parameter can be used if you append the file names or pathes located relative to your script. Say there is a test.html in the same directory, see what echo "%~dp0test.html" outputs. Regards...
by BatchEr2
04 May 2013 03:33
Forum: DOS Batch Forum
Topic: How to make .bat file open a file from any location?
Replies: 13
Views: 9957

How to make .bat file open a file from any location?

I've been doing this batch file since yesterday, and I'd like some help on this one; If my friend downloads the .zip, extracts it somewhere and runs the .bat that opens a html file, how can the bat locate it? On my own computer it is: C:\Users\käyttäjä1\Desktop\Download , but ofcourse the other guy ...