All Things WinBatch > WinBatch

Other Files When compiling

(1/2) > >>

My application requires various .txt files to be in the same folder as the .exe file.  I used to supply a zip file to the user and they were instructed to unzip the files. This worked, but it was a bit difficult for some users. So I started putting the .txt files into the OTHER FILES section when compiling the Winbatch Script.

My intent is to allow users to modify some of these .txt files. But it seems that each time the user activates the application, those .txt files overwrite any changes that have been made to the .txt files. Correct?  If this is the case then I need a different method for supplying the .txt files to the user.

Any suggestions?  Thanks.
Phil Seyer

Check out the compiler documentation for the settings dialog:

Note the "Skip auto-extraction of "Extender" and "Other Files" option.

Then check out the documentation for the compiler function ExtractAttachedFile:

At least one solution should become clear.

I want "other files" to be extracted only the first time the user starts up the .exe by double-clicking on it.
Is there an option for that?  What does "skip auto-extraction of other files mean?

Would this be the correct code for extracting the other files, where the compiled exe is called "Test.exe"  (Thanks!)

rc = ExtractAttachedFile("Test.exe",2)

No it is not correct as I discovered after making this post. Just put the filename of the file you want to be extracted.  For example,
if you want to extract a file called "hello.txt" -- use this code:

rc = ExtractAttachedFile("hello.txt,2)

I struggled with this (have a text file that could be updated) a few years ago and I came up with a solution that worked for me.

I tried the "Other Files" options and found that every time my compiled script was executed it overwrote the text file. Here's what I ended up doing because my text files started out pretty small and would grow over time as users updated them.

Instead of extracting the text file I'd have my script check for its existence (FileExist). If it didn't exist I'd have my script create it (FileOpen, FileWrite, FileClose). If the file existed, then I'd do a simple "GoTo" the next section of my script to skip the creation.

Even if a user went into the script directory (defined with DirScript) and deleted or renamed the text file, on the next execution it would create the file using my default contents.

I found that doing it on the fly like this didn't affect the execution times since text files are pretty trivial to create.

YMMV  ;)


[0] Message Index

[#] Next page

Go to full version