EXE-files with switches - Possibile or in the future

Convert your BATch files into EXEcutable format in one click.
Post Reply
Peter
Posts: 1
Joined: Mon Apr 25, 2005 6:57 am

Post by Peter »

Will it be possibile in a future version to use switches together with a created EXE, that, lets say points to two different bat-files? If using EXE without slash bat1 would be executed and if together with /? then bat2 would be executed.

This is a great app. // Peter
Oleg Tsheglov
Site Admin
Posts: 307
Joined: Fri Feb 13, 2004 5:55 pm
Contact:

Post by Oleg Tsheglov »

Good idea.
In current version you can include second batch file and parse command line parameters. If you found /? key then you may @call bat2.bat



Edited By Oleg Tsheglov on 1114464528
darcmarc
Posts: 10
Joined: Tue Feb 22, 2005 8:05 pm

Post by darcmarc »

I've not tried, but does compiled batch files support switches (so %1= whatever after the exe? ) I only have the trial but it works for me. Example code would be:

Code: Select all

@echo off
:start
if "%1" == "" (
     goto one
)
if "%1" == "/?" (
     goto two
)
:one
call bat1.bat
goto eof
:two
call bat2.bat
goto eof
:eof
cls
Or an even more optamized version:

Code: Select all

@echo off
:start
if "%1" == "/?" (
     goto two
) else (
     goto one
)
:one
call bat1.bat
goto eof
:two
call bat2.bat
goto eof
:eof
cls
Oleg Tsheglov
Site Admin
Posts: 307
Joined: Fri Feb 13, 2004 5:55 pm
Contact:

Post by Oleg Tsheglov »

Yes, EXE file work as original BAT with command line options
Post Reply