Author Topic: Invoke external exe/command.  (Read 4835 times)

jj2007

  • Member
  • *****
  • Posts: 13932
  • Assembly is fun ;-)
    • MasmBasic
Re: Invoke external exe/command.
« Reply #15 on: December 14, 2022, 07:07:57 AM »
One more ;-)

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

Code: [Select]
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

  • Member
  • **
  • Posts: 60
Re: Invoke external exe/command.
« Reply #16 on: December 14, 2022, 09:01:32 AM »
I mean:
Code: [Select]
@echo off
setvar
echo %test1%
pause
I want
Quote
echo varvalue|setvar.exe varname

jj2007

  • Member
  • *****
  • Posts: 13932
  • Assembly is fun ;-)
    • MasmBasic
Re: Invoke external exe/command.
« Reply #17 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:

bomz

  • Member
  • **
  • Posts: 60
Re: Invoke external exe/command.
« Reply #18 on: December 14, 2022, 10:14:57 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 :
Code: [Select]
string2 db 'set "_str=" & echo !_str! & echo %_str%',0

bomz

  • Member
  • **
  • Posts: 60
Re: Invoke external exe/command.
« Reply #19 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

jj2007

  • Member
  • *****
  • Posts: 13932
  • Assembly is fun ;-)
    • MasmBasic
Re: Invoke external exe/command.
« Reply #20 on: December 15, 2022, 03:15:07 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.

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 :
Code: [Select]
string2 db 'set "_str=" & echo !_str! & echo %_str%',0

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

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 10583
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Invoke external exe/command.
« Reply #21 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.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

bomz

  • Member
  • **
  • Posts: 60
Re: Invoke external exe/command.
« Reply #22 on: December 15, 2022, 10:14:48 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--

  • Administrator
  • Member
  • ******
  • Posts: 10583
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Invoke external exe/command.
« Reply #23 on: December 15, 2022, 10:57:19 AM »
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.
Code: [Select]
        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.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

bomz

  • Member
  • **
  • Posts: 60
Re: Invoke external exe/command.
« Reply #24 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

Code: [Select]
@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

  • Member
  • **
  • Posts: 115
Re: Invoke external exe/command.
« Reply #25 on: December 15, 2022, 08:38:08 PM »
I am say about CMD variable. I want create variable inside batch file
masm32 language 100% clear

Code: [Select]
@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

  • Member
  • **
  • Posts: 60
Re: Invoke external exe/command.
« Reply #26 on: December 15, 2022, 10:07:18 PM »
I am say about CMD variable. I want create variable inside batch file
masm32 language 100% clear

Code: [Select]
@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

  • Member
  • *****
  • Posts: 1317
May the source be with you

_japheth

  • Member
  • **
  • Posts: 115
Re: Invoke external exe/command.
« Reply #28 on: December 16, 2022, 12:14:30 AM »
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

  • Member
  • **
  • Posts: 60
Re: Invoke external exe/command.
« Reply #29 on: December 16, 2022, 12:17:48 AM »
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