running an exe on batch...

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

Re: running an exe on batch...

#16 Post by penpen » 10 Oct 2015 15:12

TheHunterManX wrote:So here is the output...

Nothing! when i run the file1.exe it runs cmd(command prompt to be exact) and closes a half second later and i see the numbers for a split second.
It sounds like the problem in version 1.4 is bypassing STDOUT (standard output stream) and directly prints to CON (the console device).
(I can't check/prove it because i can't test it: Version 1.4 is not available anymore.)

You could try to use a newer offline version of this converter:
Should work, if setting "visibility" to "visible" (i've tested the executable created by the online converter).

Or you could still use the workaround (sketched at the bottom of my above post):
http://www.dostips.com/forum/viewtopic.php?p=43246#p43246.

Applied to trebor68 version the resulting files are:

"File1.cmd":

Code: Select all

@echo off
setlocal
set p1=1
set p2=2
set p3=7

> "p123.txt" echo %p1% %p2% %p3%
endlocal


"File2.cmd":

Code: Select all

@echo off
setlocal ENABLEEXTENSIONS
call File1
for /f "usebackq tokens=1-3" %%a in ("p123.txt") do (
  set p1=%%a
  set p2=%%b
  set p3=%%c
)
del "p123.txt"

echo value p1: %p1%
echo value p2: %p2%
echo value p3: %p3%

endlocal
pause


penpen

Edit: Added the source code, so it's no sketch anymore.
Edit2: Corrected "never offline version of " to "newer ...".
Last edited by penpen on 10 Oct 2015 16:08, edited 1 time in total.

TheHunterManX
Posts: 54
Joined: 14 Aug 2015 05:59

Re: running an exe on batch...

#17 Post by TheHunterManX » 10 Oct 2015 15:41

Finally, after installing the latest version on b2exe and then doing it, it worked!
I will update the thread later.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: running an exe on batch...

#18 Post by foxidrive » 11 Oct 2015 02:07

foxidrive wrote:
TheHunterManX wrote:I put all my data in the Cred.bat file, then converted it to an exe.

I also do not want a temp file as it can be accessed if someone clicks it as it is being ran.


Compiled batch files work by creating the actual temporary batch script on the hard drive to run it.
and it can be accessed by anyone with the knowledge to locate it.


I'm not sure if you understand what I wrote - but you clearly didn't make any comment.

Compile this batch file, then execute the .exe file - and while the "press any key" is still showing on the screen, search your temp folder to see if you can find the original batch file.

Code: Select all

set p1=1
set p2=2
set p3=7
pause



or compile this one and it takes the work out of it for you:

Code: Select all

@echo off
set p1=1
set p2=2
set p3=7
findstr /M /L /S /c:"set p1=1" "%temp%\*.bat"
pause

Post Reply