I want to create a new environment var in the current cmd.exe. In order to do this, I wrote:

invoke SetRegString, HKEY_LOCAL_MACHINE,
CTEXT("System\CurrentControlSet\Control\Session Manager\Environment\"),

invoke SendMessage,HWND_BROADCAST,WM_WININICHANGE,0,CTEXT("Environment")

The variable is not created in the actual window but, if I open another cmd.exe, the variable is visible.

I need the to inspect the contents of that string after executing the program, in the same window. I had an old program that did it writing directly in the MCB of his father (in other words: I could execute a program in a DOS window that creates inmediately an env. variable to be examined in the next command inside a .BAT file). But this technique doesn't work in nt, 2000 or XP.

Really, I want to do something like this (in a DOS window, of course, and inside a bat):

cd > myvar.txt
myprogram myvar < myvar.txt
dir /s %myvar%\*.* > \myfile.txt

Anybody can help me?

Thanks:cool: :cool:
Posted on 2003-07-18 16:17:25 by miguelossa
dir "%~dp0"\*.* > thefile.txt

looks like to work fine. It was a pitty to lose time fitghting with assembler & API's.

But it was funny!! ;)
Posted on 2003-07-19 10:42:52 by miguelossa