![]() |
#1 |
Junior Member
Join Date: Jul 2019
Posts: 30
|
How to refresh environment variable without reboot
Hi,
I have a requirement where based on an account type selected an environment variable will be set which will be later used by one of my library to store a log file. Though the environment variable is set when I manually check the system, but reading through code gives me empty value. Hence the log is not generated in the path. I have read that environment variables require reboot in order to read through ReadENVStr. All the above process occurs while running installer. Hence I cannot reboot. Please help!! Thanks |
![]() |
![]() |
![]() |
#2 |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,176
|
Are you starting a child process that needs the variable?
IntOp $PostCount $PostCount + 1 |
![]() |
![]() |
![]() |
#3 |
Junior Member
Join Date: Jul 2019
Posts: 30
|
I have a custom page which has 2 radio buttons. And based on the radio button selection, Install Dir is set to C:\Program Files or LocalAppData folder. And this value is set to Environment Variable . Later as I proceed in one of the custom pages, I am starting a background worker, which then writes a log file to the path read from Environment variable
|
![]() |
![]() |
![]() |
#4 |
Junior Member
Join Date: Jul 2019
Posts: 30
|
Hi Anders,
Do you know whether reboot is necessary for environment variable value to reflect? Thanks |
![]() |
![]() |
![]() |
#5 |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,176
|
Take a look on the Wiki. There should be a System::Call example that sets it directly in your process (and children).
IntOp $PostCount $PostCount + 1 |
![]() |
![]() |
![]() |
|
Tags |
nsis |
Thread Tools | Search this Thread |
Display Modes | |
|
|