News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Invoke external exe/command.

Started by AssemblyChallenge, March 31, 2017, 09:07:53 AM

Previous topic - Next topic

jj2007

One more ;-)

include \masm32\MasmBasic\MasmBasic.inc
  Init
  Launch "Child.exe", passdata, FileRead$("\Masm32\include\Masm32rt.inc")
EndOfCode


include \masm32\MasmBasic\MasmBasic.inc
  Init
  PrintLine "Received from parent process:", CrLf$, ParentData$()
EndOfCode


There is a 64k limit: msvcrt.inc is ok, setupapi.inc is too long.

bomz

I mean:
@echo off
setvar
echo %test1%
pause

I want
Quoteecho varvalue|setvar.exe varname

jj2007

Please be more verbose: try a full paragraph explaining what you want to do. Maybe I am just too stupid to understand what you want, but verbosity may help. If English is not your first language, try deepl.com :thup:

bomz

Quote from: jj2007 on December 14, 2022, 09:17:32 AM
Please be more verbose: try a full paragraph explaining what you want to do. Maybe I am just too stupid to understand what you want, but verbosity may help. If English is not your first language, try deepl.com :thup:
I suppose this string make all clear : string2 db 'set "_str=" & echo !_str! & echo %_str%',0

bomz

as I catch need to load application to CMD.EXE process context, create variable and go out

jj2007

Quote from: bomz on December 15, 2022, 03:06:45 AM
as I catch need to load application to CMD.EXE process context, create variable and go out

Doesn't look like English. What is your native language? Please formulate a complete, meaningful phrase and let deepl.com translate it, so that we have a chance to understand what you really want.

Quote from: bomz on December 14, 2022, 10:14:57 AM
Quote from: jj2007 on December 14, 2022, 09:17:32 AM
Please be more verbose: try a full paragraph explaining what you want to do. Maybe I am just too stupid to understand what you want, but verbosity may help. If English is not your first language, try deepl.com :thup:
I suppose this string make all clear : string2 db 'set "_str=" & echo !_str! & echo %_str%',0

No, "this string make all clear" НЕТ!

hutch--

bomz,

You can run ANY executable file with CreateProcess(). CMD.EXE is just a 64 bit executable file.

bomz

Quote from: hutch-- on December 15, 2022, 03:18:33 AM
bomz,

You can run ANY executable file with CreateProcess(). CMD.EXE is just a 64 bit executable file.
and how create variable global to two console?

hutch--

I don't claim to uinderstand what you are after but creating the same named GLOBAL variable in two apps is easy. You need some method of inter application communication to connect them.

Two (2) techniques,
1. SendMessage using the HWND_BROADCAST message for signalling.

        rcall SendMessage,HWND_BROADCAST,PM_COMMAND,0,0

2. Memory mapped files for data.

If one is calling the other, the command line works OK.

bomz

I am say about CMD variable. I want create variable inside batch file
masm32 language 100% clear

@echo off
setvar
echo %newvar%
pause


I am creating batch file now and have problem to create global variable standard methods because number of iterations to big inside cycles. So it is not so easy as may seem

_japheth

Quote from: bomz on December 15, 2022, 11:19:17 AM
I am say about CMD variable. I want create variable inside batch file
masm32 language 100% clear

@echo off
setvar
echo %newvar%
pause


I am creating batch file now and have problem to create global variable standard methods because number of iterations to big inside cycles. So it is not so easy as may seem

What about using the /P option?

C:\>echo abc >tmpfile & set /P newvar= <tmpfile

should result in "newvar=abc"




Dummheit, gepaart mit Dreistigkeit - eine furchtbare Macht.

bomz

Quote from: _japheth on December 15, 2022, 08:38:08 PM
Quote from: bomz on December 15, 2022, 11:19:17 AM
I am say about CMD variable. I want create variable inside batch file
masm32 language 100% clear

@echo off
setvar
echo %newvar%
pause


I am creating batch file now and have problem to create global variable standard methods because number of iterations to big inside cycles. So it is not so easy as may seem

What about using the /P option?

C:\>echo abc >tmpfile & set /P newvar= <tmpfile

should result in "newvar=abc"
much better but how do it without TMP file
echo abc|set /p bewvar=

TimoVJL

CMD.EXE have SETX command and can be problematic.


https://stackoverflow.com/questions/13222724/command-line-to-remove-an-environment-variable-from-the-os-level-configuration
May the source be with you

_japheth

Quote from: bomz on December 15, 2022, 10:07:18 PM
echo abc|set /p bewvar=

You're right, this "should" work, but obviously does not.

As a workaround, perhaps you might use FOR:

c:\>for /F %i in ('echo bomz') do set newvar=%i
Dummheit, gepaart mit Dreistigkeit - eine furchtbare Macht.

bomz

Quote from: _japheth on December 16, 2022, 12:14:30 AM
Quote from: bomz on December 15, 2022, 10:07:18 PM
echo abc|set /p bewvar=

You're right, this "should" work, but obviously does not.

As a workaround, perhaps you might use FOR:

c:\>for /F %i in ('echo bomz') do set newvar=%i
I am exactly want make utility which allow avoid FOR such cases