({{, (RefLink[$Initialization, paclet:ref/$Initialization]) 
is a symbol whose value, if any, is evaluated with (RefLink[ReleaseHold, paclet:ref/ReleaseHold])[$Initialization] at the start of a Wolfram Language session.}})

OpenersNotesSection(Spacer1)Details

Persistent values of (RefLink[$Initialization, paclet:ref/$Initialization]) are typically set with (RefLink[InitializationValue, paclet:ref/InitializationValue])[$Initialization]=(RefLink[Hold, paclet:ref/Hold])[expr].

Values defined in different persistence locations on (RefLink[$PersistencePath, paclet:ref/$PersistencePath]) are joined with (RefLink[Flatten, paclet:ref/Flatten]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (4)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Set a value to be evaluated every time the kernel starts:

InitializationValue[$Initialization]=Hold[data=Get["mydata.m"]]

Set a value that persists only during a front end session:

InitializationValue[$Initialization,"FrontEndSession"]=Hold[SetDirectory[CreateDirectory[]]]

View the current initialization value:

InitializationValue[$Initialization]

OpenersExampleSection2(Spacer1)Properties & Relations  (2)

Initialization values are stored in persistent objects:

PersistentObjects["*$Initialization"]

List the existing initialization values for (RefLink[$Initialization, paclet:ref/$Initialization]) in all editable persistence locations:

InitializationObjects[$Initialization,{"FrontEndSession","Local","Notebook","Cloud"}]

Remove them:

DeleteObject[Values[%]]

OpenersExampleSection3(Spacer1)Possible Issues  (1)

Create two initialization values for (RefLink[$Initialization, paclet:ref/$Initialization]) in different locations:

InitializationValue[$Initialization]=Hold[data=Get["mydata.m"]];
InitializationValue[$Initialization,"FrontEndSession"]=Hold[SetDirectory[CreateDirectory[]]];

(RefLink[Remove, paclet:ref/Remove]) by default removes only the value in the location given by (RefLink[$PersistenceBase, paclet:ref/$PersistenceBase]):

Remove[InitializationValue[$Initialization]]

InitializationValue[$Initialization]

Remove all values that might exist anywhere in all editable locations given by (RefLink[$PersistencePath, paclet:ref/$PersistencePath]):

Remove[InitializationValue[$Initialization,$PersistencePath]]

The default value is still present:

InitializationValue[$Initialization]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[InitializationValue, paclet:ref/InitializationValue])  ▪  (RefLink[Initialize, paclet:ref/Initialize])  ▪  (RefLink[$PreInitialization, paclet:ref/$PreInitialization])  ▪  (RefLink[Once, paclet:ref/Once])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Wolfram System Setup, paclet:guide/WolframSystemSetup])}, {▪(RefLinkPlain[Initialization & Provisioning, paclet:guide/InitializationAndProvisioning])}, {▪(RefLinkPlain[Setting Persistent Values, paclet:guide/SettingPersistentValues])}, {▪(RefLinkPlain[Session Customization, paclet:guide/SessionCustomization])}, {▪(RefLinkPlain[Persistent Storage, paclet:guide/PersistentStorage])}})}})