Compiling I7 from command line in Windows

I’m trying to compile a story file from the terminal on Windows 10. (The reason for doing this is to use my preferred text editor without having to copy and paste the whole source text into the IDE before every compilation.) I’m running this command, copied from the IDE’s debugging log:

"C:\Program Files (x86)\Inform 7\Compilers\ni" -internal "C:\Program Files (x86)\Inform 7\Internal" -project C:\Users\FriendOfFred\Documents\Inform\Projects\test.inform -format=z8

The result is that the compilation succeeds until almost the end, then apparently fails to write the index:

Inform 7 build 6M62 has started.
++ 0% (Reading text)
I've now read your source text, which is 278 words long.
++ 5% (Analysing sentences)
I've also read Standard Rules by Graham Nelson, which is 42655 words long.
I've also read English Language by Graham Nelson, which is 2297 words long.
++ 15% (Drawing inferences)
++ 20% (Binding rulebooks)
++ 23% (Binding rulebooks)
++ 26% (Binding rulebooks)
++ 29% (Binding rulebooks)
++ 32% (Binding rulebooks)
++ 35% (Binding rulebooks)
++ 38% (Binding rulebooks)
++ 41% (Generating code)
++ 44% (Generating code)
++ 47% (Generating code)
++ 50% (Generating code)
++ 53% (Generating code)
++ 56% (Generating code)
++ 59% (Generating code)
++ 62% (Generating code)
++ 65% (Generating code)
++ 68% (Generating code)
++ 71% (Generating code)
++ 74% (Generating code)
++ 77% (Generating code)
++ 80% (Generating code)
++ 83% (Generating code)
++ 86% (Generating code)
++ 89% (Generating code)
++ 92% (Generating code)
++ 95% (Generating code)
++ 98% (Generating code)
Unable to open extensions documentation index for writing
Offending filename: <Inform\Documentation\Extensions.html>

Someone seems to have had the same problem in this thread, but I don’t understand the advice given there. I’ve tried setting the environment variables HOME, HOMEPATH, and USERPROFILE either to my user directory or my Documents directory (the latter is the default location for Inform projects), but they have no effect on the I7 compilation. I must be missing something?

1 Like

That output shows that the HOME environment variable is not set to anything - it needs to point to the “My Documents” directory you’re using.

Since you say you’ve set it, something must be wrong somewhere. How are you setting it? Since processes inherit environment variables from the process that starts them, have you restarted the text editor after setting HOME?

1 Like

The Mac GUI uses this command line:

ni “-internal” “/Applications/Local Apps/Inform-7/” “-external” “/Users/zarf/Library/Inform” “-project” “/Users/zarf/src/if/new-test.inform” “-format=ulx”

So maybe you can use -external to set that location to the absolute path of your docs directory.

1 Like

This looks like a permissions issue to me. Make sure the executables have rights to your target folder(s).

Yeah, I just needed to restart Windows Terminal after setting the environment variable. I knew it was something stupid like that. Thanks!

By the way, @zarf’s solution also works, and in fact might be preferable, since it seems that setting HOME manually can screw up other things.

Another problem. When compiling from the command line, Inform can’t find installed extensions, though built-in extensions still work.

I've also read Standard Rules by Graham Nelson, which is 42655 words long.
I've also read English Language by Graham Nelson, which is 2297 words long.
I've also read Basic Screen Effects by Emily Short, which is 2218 words long.
I've also read Glulx Text Effects by Emily Short, which is 2182 words long.
  >--> I can't find the extension 'Unknown Word Error by Mike Ciul', which
    seems not to be installed, but was requested by: 'Include Unknown Word
    Error by Mike Ciul' (source text, line 36). You can get hold of extensions
    which people have made public at the Inform website,, or by
    using the Public Library in the Extensions panel.
++ Ended: Translation failed: 1 problem found

This with an extension that’s definitely installed in Documents\Inform\Extensions and a source text that compiles correctly in the IDE. Perhaps someone could give me a hint?

Edit: Experimenting shows that project-specific extensions also still work, so I could work around this by making a new copy of every extension used in each project. But it seems senseless to have to do that.

Are you still setting the HOME envionment variable? I’m moderately sure (but can’t check right now) that that is what ni uses to find the extensions.

I thought it used -external.

Another solution is to put all the needed extensions in the project.materials folder.

Setting HOME and using the -external flag both worked on my previous problem. Neither seem to have any effect on this one. (Yes, I did remember to restart the terminal after setting HOME this time!)

Hmmm, then it really ought to work. The front-end doesn’t do anything unusual in running “ni” - it sets the HOME environment variable, and runs the command that it shows on the console.