Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Make a few .exe files 3

Status
Not open for further replies.

greathope123

Programmer
Nov 1, 2011
84
GB
Hi,

Based on Project1.vbp + Module1.bas, we can make Project1.exe file.
Do you know any easy way to make a few ProjectN.exe files based on a few ProjectN.vbp + ModuleN.bas?
 
Write a script or a CMD/BAT file. VB.EXE can be run from the command line.

Code:
    VB6[.EXE]  [[{/run | /r}] | [/runexit] | [{/make | /m}] projectname]
               [/out filename] [/outdir path] [/d const=value{[:constN=valueN]}]
               [/mdi | /sdi] [{/cmd argument | /c argument}]

    Options:

    /run or /r projectname  Tells Visual Basic to compile projectname and run it,
                            using the arguments stored in the Command Line
                            Arguments field of the Make tab of the Project
                            Properties dialog box.

    /runexit projectname    Tells Visual Basic to compile projectname and run it.
                            Visual Basic will exit when the project returns to
                            design mode.

    /make or /m projectname Tells Visual Basic to compile projectname and make an
                            executable file from it, using the existing settings
                            stored in the project file.

    /out filename           Specifies a file to receive errors when you build using
                            /m or /runexit. If you do not use /out, command line
                            bild errors are displayed in a message box.

    /outdir path            Specifies a directory path to place all output files in
                            when using /make.  This path must already exist.

    /d or /D const=value... Tells Visual Basic which values to use for conditional
                            compilation constants when making an .EXE or ActiveX
                            component with the /make switch.  Separate multiple
                            constants with colons.

    /cmd or /c argument     Specifies a command string to be passed to the Command$
                            function. When used, it must be the last switch on the
                            command line.

    /mdi or /sdi            Changes the Visual Basic environment to either Single
                            Document Interface (SDI) or Multiple Document Interface
                            (MDI) mode.  Visual Basic remains in this mode until
                            you change it.

    /?                      Displays a list of valid command line switches.

    You may use a group name in place of projectname in any of the above switches.
 
Thanks a lot! That looks very nice!
However, I have never tried that and got error:

In a .vbs file
VB6.EXE C:\Users\MyAccount\Project1.vbp
when run the .vbs in the command line, I got error: Expected statement
 
greathope123:
What you typed is a command, not a vbscript... it should be executed by typing it at a command prompt, or saving into a batch file (with a .BAT extension, not .VBS) and executing the batch file (by typing its name at a command prompt and hitting Enter)
 
guitarzan,

OK, follow your instruction, I changed the file to a batch file Try.bat with a line inside:
VB6.EXE C:\Users\MyAccount\Desktop\Project1.vbp
In the command line, I tried
C:\Users\MyAccount\Desktop>Try.bat
however, I got error:
'VB6.EXE' is not recognized as an internal or external command, operable program or batch file.
 
You will have to locate where the vb6 exe is located, and run it from there. I don't have vb installed here, but going by the link below, it should be found by default in c:\Program Files\Microsoft Visual Studio\VB\vb6.exe

If your install matches, this should work (not tested):

Try.bat:
"c:\Program Files\Microsoft Visual Studio\VB\vb6.exe" C:\Users\MyAccount\Project1.vbp

I should clarify... I don't have experience using VB6 from a command prompt, just trying to explain how dilettante's suggestion should be executed. I don't know that the command above is correct, just that it will execute (as opposed to what you were trying earlier)
 
A slightly more complicated approach but an effective one if you are compiling multiple vbps is exemplified in thread707-1672128
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top