# IDAPython Script works from “Script File” but not when run with -S from Terminal

I'm trying to run an IDAPython script in IDA 7.1 on Windows 10 and it runs just fine when I run it from the Script File... command, but if when I run it from the command line it isn't working properly. My command to run it from the command line is:

ida64 -A -SC:\path\to\script\databaseAll.py C:\path\to\ELFexecutable\target0

If I open the file in the graphical interface first and pack the database, then it works from the command line in creating the database correctly, but otherwise it has a lot of information that's missing.

Am I doing something wrong? How do you properly run a script from the command line?

• What specifically is “missing”? – Igor Skochinsky Sep 10 '18 at 7:25
• I was trying to create a database that had information about sections (based on what IDA inaccurately calls "segments"), symbols, and xrefs. When run from the command line, the database has only one or two lines where it should have two dozen or more. – theTheodidact Sep 18 '18 at 15:59

You need to run idc.auto_wait in the python script to allow IDA to process all the entries in it's auto-analysis queue before it tries to navigate around based on analysis-dependent features.