Hi!
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\"),
CTEXT("NewVar"),
CTEXT("g?fs")
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:
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\"),
CTEXT("NewVar"),
CTEXT("g?fs")
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:
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!! ;)
looks like to work fine. It was a pitty to lose time fitghting with assembler & API's.
But it was funny!! ;)