Pass parameters to bat compiled to exe.

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
JuanMa777
Posts: 17
Joined: 06 Nov 2016 13:15
Location: La Plata, ¡Argentina!

Pass parameters to bat compiled to exe.

#1 Post by JuanMa777 » 07 Nov 2016 07:24

Hi, I have an script that requiere parameters to complete your function.
Some like,

Code: Select all

echo %1

and then, c:\>script.bat Maradona!
but more complex.
This is simple, the question is that I need to compile to exe my script to hide the content, and when I do this I can't no more pass it the parameters.
c:\>script.exe Maradona! ---> error
How can I solve this?
Thanks.

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Pass parameters to bat compiled to exe.

#2 Post by aGerman » 07 Nov 2016 08:02

Batch cannot be compiled. What you get is something like an installer or self-extracting archive. As soon as run the exe file it will unpack your plain batch script somewhere into the %temp% folder and run it there. So forget about hiding the content. Everything is perfectly visible during the runtime.

Exactly for reasons like you mentioned I'd call those tools bloody bulls***. Depending on the used tool parameters are not available, the working directory is wrong, it runs the script in WOW64 compatibitility mode, antivirus software fires false positives, or whatever side effects you can think of. If you have a batch script run it as batch script. If you need a compiled exe file use a compilable language.

Steffen

JuanMa777
Posts: 17
Joined: 06 Nov 2016 13:15
Location: La Plata, ¡Argentina!

Re: Pass parameters to bat compiled to exe.

#3 Post by JuanMa777 » 07 Nov 2016 08:21

Thanks Steffen, very light, I'll try another solution.
Regards.

Post Reply