Solved How to update parent envirement?

July 7, 2013 at 06:40:53
Specs: MS-DOS 8+ (WINDOWS XP APLICATION "CMD.EXE" RUNNING TRUGHT "NTVDM.EXE" AS AN APPLICATION INSIDE WINDOWS XP), 4 CORES OF 2.4 GHZ/AND 4GB OF RAM
HAY PEOPLE,

I AM STILL WRITING MY PROGRAM IN CMD.
AND I AM STARTING USING MULTITASKING (MULTIPLE CHILED COMMAND PROCCESSORS STARTED BY ONE PARENT COMMAND PROCCESSOR).

I HAVE A PROBLEM, BECAUSE I DO NOT KNOW HOW TO RETURN A VALUES FROM CHILD PROGRAM TO PARRENT.

SO, I CAN SEND A FEW VARIABLES IN CHILED PROGRAM AND PROGRAM DEFINES IT IN ITS ENVIREMENT.

HOWEVER, OPPOSITE FROM THAT DOES NOT WORK.
I MEAN, I NEED THAT WHEN A CHILD PROGRAM FINISH WITH ITS WORK, THAT IT RETURN A VARIABLE IN PARRENT PROGRAM, SO THAT PARRENT PROGRAM CAN STORE IT IN ENVIREMENT.
BUT IMPORTANT HERE IS THAT THOSE PROGRAM HAS TO BE MULTITASKING ABLE.
BY THAT I MEAN, THAT PARENT PROGRAM SHOULD NOT STOP EXECUTION WHILE CHILED PROGRAM IS RUNNING.
CHILED PROGRAM SHOULD UPDATE PARENTS PROGRAM ENVIREMENT WHILE PARENT PROGRAM IS EXECUTING OTHER TASKS.

UNTILL NOW, I CAN MAKE MULTIPLE THREATS, BUT I DO NOT KNOW HOW TO CONNECT THAM.


SO, IS IT POSSIBLE TO UPDATE CMD ENVIREMENT VARIABLES OF BATCH PROGRAM FROM OTHER CMD BATCH PROGRAM? :)


THANK YOU FOR READING. :P


See More: How to update parent envirement?

Report •


✔ Best Answer
July 7, 2013 at 09:18:32
SYOBSYOT: i do not see why not.
Razor2.3: Parents do not inherit from their children. This is one of the fundamental rules of modern computing environments.

SYOBSYOT: can i update envirement of running cmd window from another cmd window?
Not without hacking techniques. By "hacking techniques" I mean injecting and executing code in the parent's process address space. Race issues are a concern but a given when you're modifying an unsuspecting program's memory.

SYOBSYOT: for example, where is original envirement[sic] stored?
Environment variables are saved as an array of strings in the process' memory. Call the WINAPI function GetEnvironmentStrings() to get the pointer to the array; consult MSDN for more details.

SYOBSYOT: if is it in windows registry, at which location?
It is not stored in the registry. Nothing as volatile as environment variables for a single process should be stored in the registry. It is stored in the process' memory space.

SYOBSYOT: i know of some utilities which are capable of for example hidding other windows, resizing tham, moving tham on screen, and so on.
Those utilities send various window messages. Messages are Windows' original interprocess communication system.

How To Ask Questions The Smart Way



#1
July 7, 2013 at 06:59:38
Seriously man, fix your shift key. It's sticking and making your posts hard to read. When you're asking others for help, it's not in your best interest to make things harder on them.

Parents do not inherit from their children. This is one of the fundamental rules of modern computing environments.

What you're describing is interprocess communication, and it typically involves some way of transferring data, some signaling mechanism to note when the data's ready, and possibly multiple threads inside the parent process.

I suggest you refactor your program to run from a single process, or pick up a language that can accommodate your magnum opus.

How To Ask Questions The Smart Way


Report •

#2
July 7, 2013 at 07:31:00
even now, i have an alternative.
to make child program dump its data to a data file, and parent program checks if data file is there, and if it is, it sets its data into parent envirement.

that works without any problem. just it is not instant. but it does not have to be. i can make loop in parrent program which checks for child program dumpfile periodicly.

so, i can alredy make that child program dumps data, and that parrent program collect it.

but do not think about my question like it is about some complex programing problem.

look at my question like this (very simple):


is there a command which i can type in cmd which can affect other cmd envirement variable?

that is my problem. i alredy know how to communicate betwean child and parent program.
just i want to get rid off intermediate file, and make envirement updates direct.


but you should not think about interprocess communication.

just think about this siple version of qouestion, and i will make it into program code which will alow child program to send data to parrent program.
it is possible, because i am alredy doing it, just over data file.


so, just answer this:

can i update envirement of running cmd window from another cmd window?

for example, where is original envirement stored?
if is it in windows registry, at which location?

i think that making global envirement changes will affect parent window too.
just i want it to be applyed immediatly, not after restarting cmd.


that is what i want to know.
is it possible to edit it?
and dealing with communication is my problem. ;)


one more suggestion.
i know of some utilities which are capable of for example hidding other windows, resizing tham, moving tham on screen, and so on.

is there any utility which is capable of updating programs envirenment variables?

i do not see why not.
if there is, i can install it in system32 and use it as a cmd command in my batch script.
of course, that utility can be 32bit or 16bit, but if is 32bit, it have to be configurable from cmd.

now, you know a littlle better what i want.

so, does anyone know anything? :d


Report •

#3
July 7, 2013 at 07:59:31
You're burning through the good will of people who might help.

=====================
M2 Golden-Triangle


Report •

Related Solutions

#4
July 7, 2013 at 08:07:43
NICE TO KNOW. ;P


I LOVE YOU TOO.


Report •

#5
July 7, 2013 at 09:18:32
✔ Best Answer
SYOBSYOT: i do not see why not.
Razor2.3: Parents do not inherit from their children. This is one of the fundamental rules of modern computing environments.

SYOBSYOT: can i update envirement of running cmd window from another cmd window?
Not without hacking techniques. By "hacking techniques" I mean injecting and executing code in the parent's process address space. Race issues are a concern but a given when you're modifying an unsuspecting program's memory.

SYOBSYOT: for example, where is original envirement[sic] stored?
Environment variables are saved as an array of strings in the process' memory. Call the WINAPI function GetEnvironmentStrings() to get the pointer to the array; consult MSDN for more details.

SYOBSYOT: if is it in windows registry, at which location?
It is not stored in the registry. Nothing as volatile as environment variables for a single process should be stored in the registry. It is stored in the process' memory space.

SYOBSYOT: i know of some utilities which are capable of for example hidding other windows, resizing tham, moving tham on screen, and so on.
Those utilities send various window messages. Messages are Windows' original interprocess communication system.

How To Ask Questions The Smart Way


Report •

#6
July 7, 2013 at 17:52:30
OKEY.

IN THIS CASE, I AM STUCK WITH DATAFILE, AND PARRENT PROGRAM CHECKING PERIODICALLY THAT FILE FOR UPDATES BY CHILD PROGRAM.


ANYWAY, THANX FOR YOUR TIME. ;)

BYE. :D


Report •


Ask Question