What are the Command Line options for the VB6 IDE (Compiler) - vb6

I'm doing batch compiling and need to specify the output directory.

/run
/runexit - Compile and then run it. Exit VB IDE when project returns to design mode.
/make or /m projectname - compiles an makes exe using the existing settings in proj file
/out filename
/outdir path Specifies a directory path to place all output files in when using /make
/d
/cmd
/mdi or /sdi
... and a couple of others.
Run vb6.exe /? for more information.

A bit of Google work suggests that such a list of options can be obtained by going to the directory containing vb6.exe in Command Prompt and running
vb6.exe /?

VB6
Information directly from running VB6.exe /?:
Command Line Options
VB6[.EXE] [[{/run | /r}] | [/runexit] | [{/make | /m}] projectname] [/out filename]
[/outdir path] [/d const=value{[:constN=valueN]}]
[/mdi | /sdi] [{/cmd argument | /c argument}]
/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 build
errors are displayed in a message box.
/outdir path Specifies a directory path to place all output files in
when using /make.
/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 Puts argument in the Command Line Arguments
field in the Make tab of the Project Properties dialog box. When used,
this 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.
You may use a group name in place of projectname in any of the above
switches.
Sourced from here is some additional information which pertains to older versions of VB as well. That external page may eventually disappear.
VB Command Line Summary
All Versions
vb*[.exe] [[{/run | /r} projectname] {/make | /m } projectname]
{/cmd argument | /c argument}]
projectname The name of your project (.vbp) file.
/run or /r Tells Visual Basic to compile and run projectname using
the arguments stored in the Command Line Arguments field of the Make
tab of the Project Properties dialog box. You can run more than one
project using this command. Replace projectname with
projectgroupname.
/make or /m Tells Visual Basic to compile projectname and make
an executable (.exe) file, using the existing settings of the Path,
EXEName, and Title properties of the APP object. You can compile and
make an executable (.exe) file from more than one project using this
command. Replace of the projectname with projectgroupname.
/cmd or /c Puts argument in the Command Line Arguments field in
the Make tab of the Project Properties dialog box. When used, this
must be the last switch on the command line.
Versions 4 + Only
vb*[.exe] {/d compileconst} [{/makedll | /l} projectname]
/makedll or /l Tells Visual Basic to compile projectname and make
an in-process ActiveX server (.dll) file from it.
/d or /D Tells Visual Basic which values to use for conditional
compilation constants when making an .EXE with the /make switch or an
ActiveX DLL with the /makedll switch.
compileconst The names and values of conditional compilation
constants used in the project file.
Version 5+ Only
vb*[.exe] [{/runexit} projectname][{/m} or {/runexit} projectname /out filename}][{/m}][/sdi] or [/mdi]
/runexit Tells Visual Basic to run projectname. If for any reason
the file is changed in the process of running, all changes are ignored
and no dialog appears on exit to design mode.
filename The name of the file to receive errors when you build an
executable using the /m or /runexit option.
/out Allows you to specify a file to receive errors when you build
using the /m or /runexit option. The first error encountered is
placed in this file with other status information. If you do not use
the /out option, command line build errors are displayed in a message
box. This option is useful if you are building multiple projects.
/? Lists the available Command Line arguments.
/sdi Changes the Visual Basic environment to SDI (Single Document
Interface) mode. Visual Basic remains in SDI mode until you change it.
You can change to MDI mode by using the /mdi argument or by clearing
the SDI Development Environment option in the Advanced tab of the
Options dialog box.
/mdi Opens Visual Basic in MDI (Multiple Document Interface) mode.
Visual Basic remains in MDI mode until you change it. You can change
to SDI mode by using the /sdi argument or by selecting the SDI
Development Environment option in the Advanced tab of the Options
dialog box. MDI mode is the default.

/make /outdir path

Here is the output of vb6.exe /?

Related

Using Developer Command Line in Build events (or bat files)

I want to compile a resource before building, hence using the build event before building.
I want to open the "Developer command prompt" and run rc.exe myFile.rc
In my build event, pre-build, I can simply add
"C:\Program Files (x86)\Windows Kits\10\bin\10.0.17134.0\x86\rc.exe" $(ProjectDir)TestFile1.rc
The issue is that there are a number of folders in that bin, 10.0.otherNumbers... so this line works on my computer, but not necessary on other computer or in the future.
Is there a macro, like $(DevEnvDir) for the right path here?
Something like:
"$(DeveloperCommandPrompt)\rc.exe" $(ProjectDir)TestFile1.rc
Or a way to enter developer Command prompt from the ordinary command prompt, as it would be needed in a bat file

How do I use this command in a pre build event in Visual Studio

I will be concise.
The command FOR /F %i IN (C:\Version.txt) DO #set Version=%i works perfectly fine in cmd.exe to read the text of the file into a variable. but whenever I put that line into a prebuild event in Visual Studio it says Exited with code 255.
On http://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx I found that 0xFF / 255 means: The extended attributes are inconsistent..
How do I use that command in a pre build event?
Many thanks.
The correct syntax is
FOR /F %%i IN (C:\Version.txt) DO #set Version=%%i
However this will not work as you epxect: VS spawns a cmd.exe process to execute build events, meaning that if you set a variable it is local to that cmd.exe only, hence the rest of your build will not have access to Version.
Luckily there are much better alternatives than batch files: if you're using VS2010 or higher, the project files are msbuild files, so to get all possible versioning things working you just create a common msbuild script to do whatever you need to do with the version (eg create a .res file if it's for C++, or modify the AssemblyInfo.cs for C#) and include it in all your projects.

Finding build output in Visual Studio 6 (visual basic)

I realize this is going to be an exotic question, but I just can't find the answer.
I'm trying to fix up and enhance an old visual basic-based application.
My problem is: where is the output directory with the compiled binaries?
Thanks.
If some clarification is needed, please ask.
In the .VBP, if there is a line specifying the path like this
Path32="C:\"
Then the resulting EXE will be built at that location. Otherwise, it will be built in the same directory as the .VBP file. The path can be relational as well and may not be a fully qualified path.
I think you want the /outdir switch. This overrides the Path32 setting in the Project file.
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.
Works fine here.
There is no equivalent 'bin/lib' output directory for VB6. When you compile a VB6 project, the default is to compile to the same folder as the project (vbp file). It is also possible to compile to any other folder available to the user.

How to pass command line arguments to InstallShield debugger?

When running the InstallShield X debugger I can't find a way to tell it to run silently in order to debug a silent install.
The debugger seems to run the equivalent of a "setup.exe" command line which displays the GUI, but I want "setup.exe /s" which takes input from setup.iss.
Is there a way to specify command line parameters for debugging?
There are multiple ways to start the InstallScript debugger. You can start it from the InstallShield IDE, which is what I expect you're doing. Or you can start it from the command line of your setup with /d. Mix the /s and /d together, and you should be able to debug the silent case. Or if this is an InstallScript MSI, you may also want to set certain MSI properties to enable debugging of custom actions.
See Setup.exe and Update.exe Command-Line Parameters for details, looking at the Debugging section which describes both /d and /v"ISSCRIPTDEBUG=1 ISSCRIPTDEBUGPATH=\"path-to-Setup.dbg\""

How can I rename a VB6 executable?

I'm trying to automate a VB6 build where different apps are built from the same source by:
Changing "Conditional Compilation Arguments".
"Make Project" to a different executable name.
I can do part of this on the command line:
VB6.EXE /m Project.VBP /d BUILD_OTHER_APP=1
but the executable still has the name "Project.exe". If I rename the .EXE it stops working (doesn't seem to run). VB6 doesn't seem to have a command line option to set the executable name and I can't get round this problem with renaming.
I'm using VB6 on Win7 32-bit.
If you run VB6 /? from the command line a dialog box pops up to tell you all the options, and no, it seems that there isn't an option to specify the output filename.
I can't as yet see any reason for a rename to stop an executable working, but I'll try this later on today on Win XP.
The other workaround to renaming is to move the executables into folders of different names and create shortcuts or batch files of different names to call the correct executable.
edit: I'm working on Win XP and these two solutions are available to me:
Rename the executable - You might be able to develop on XP and run on Win7?
Add the .exe name to the build command line. This does override the .vbp:
VB6 /m Project1 /d conHello=-1 Hello.exe
VB6 /m Project1 /d conHello=0 World.exe
The hack that we are forced to do to create a different named output (and to change other aspects of the project) is to create a copy of the VBP (Project_tmp.vbp), and then change the name in the copy and build from that copy.

Resources