amakvana / Bat-2-Exec

Bat-2-Exec - A wrapper for converting Batch files into Executables using IExpress
MIT License
36 stars 5 forks source link

Error #1

Closed AuraClient closed 3 years ago

AuraClient commented 3 years ago

So I created a batch file that echoes a random number in a new text file. The .EXE file however doesn't work. Can you help?

amakvana commented 3 years ago

Could you provide me the batch file you're using? Just want to have a look at the code so I can replicate the issue

AuraClient commented 3 years ago

Thank you for your response, I cannot send you the EXACT file because it reveals some personal info. I will send you a .TXT file that has the same thing but with different variables and "echoes."

On Wed, Apr 21, 2021 at 6:34 AM Akash Makvana @.***> wrote:

Could you provide me the batch file you're using? Just want to have a look at the code so I can replicate the issue

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/amakvana/Bat-2-Exec/issues/1#issuecomment-823959392, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATUF36SXXINRP2DWQV6TW63TJ2S2ZANCNFSM43IB7PWA .

@echo off cls echo What is your favorite color set /p color= echo %color%>color.txt cls exit

amakvana commented 3 years ago

Thanks for that, as soon as I get some free time tonight I'll test and get back to you :)

AuraClient commented 3 years ago

Sounds good, thanks!

On Thu, Apr 22, 2021 at 11:05 AM Akash Makvana @.***> wrote:

Thanks for that, as soon as I get some free time tonight I'll test and get back to you :)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/amakvana/Bat-2-Exec/issues/1#issuecomment-824922966, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATUF36SCXARAIR3VJWAWQOTTKA3LTANCNFSM43IB7PWA .

amakvana commented 3 years ago

Ok so I have tested this. It's one of the limitations with IEXPRESS, How IEXPRESS works, is that it copies the bat script into a folder located in %TEMP%\IXP000.TMP\ and then executes it within that directory. Once the script is completed, the folder is then deleted by itself.

See HERE and HERE for a thorough explanation.

What you can do to resolve it is use the copy /y command at the end of your script to copy the txt file into a permanent location. So for example, you could do the following:

@echo off
cls
echo What is your favorite color
set /p "color="
echo %color% >"color.txt"
copy /y "color.txt" "%userprofile%\desktop\color.txt"
cls
exit 

Hope that helps

AuraClient commented 3 years ago

Awesome, thanks!

On Mon, Apr 26, 2021 at 2:44 AM Akash Makvana @.***> wrote:

Closed #1 https://github.com/amakvana/Bat-2-Exec/issues/1.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/amakvana/Bat-2-Exec/issues/1#event-4642715928, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATUF36SXYHUBJA2WVH6K7S3TKUDWRANCNFSM43IB7PWA .