Can you give me a quick tutorial?
I've got what I think should be fairly simple VB program that I need to compile into a stand alone EXE that can be run from the command line with a single argument:
(Basically I need an EXE that calls a VB Script.)
Code:
Module Module1
Sub Main()
'DEBUG MESSAGE - Show what you're doing next...
MsgBox("Calling " & Chr(34) & "C:\Program Files\Script\Script.vbs" & Chr(34) & " " & Command())
'CALL THE SCRIPT WITH THIS EXE's COMMAND LINE ARGUMENT
Shell("C:\Program Files\Script\Script.vbs " & Command())
End Sub
End Module
I've download MS Visual Studio 2005 Visual Basic Express, but don't have a clue how to get this compiled or published or whatever it's called in this version.
Does anyone have a clue x four that cam be applied upside my head to blast me into the right direction to making a stand-alone EXE of this code?
Re: Can you give me a quick tutorial?
Set the configuration to Release and then from the Build menu choose the Build Solution or ApplicationName option. Then go and look in the Release folder inside of your project folder for the .exe file.
Re: Can you give me a quick tutorial?
I don't get a release option. My debug tab only has :
Start Options:
Commmand Line Options:
Working Directory:
[ ] Enable the Visual Studio Hiosting process
Should I have a Debug/Release option on this tab?
Or am I looking in completely the wrong place?
To start from scratch, I created a new project as a console application and pasted in the previous code, but still don't find RELEASE.
(I'm pretty sure that my SHELL call isn't doing to work either, but I fugured the hard part would be the compile, and I can worry about the call later.)
Re: Can you give me a quick tutorial?
Change it on the Debug tab. There should also be a place to do this in the toolbar. (Probably near your Run button.)
Re: Can you give me a quick tutorial?
Instead of Shell, you can also use Process.Start().
May I ask why you are calling a VBScript from a VB app when you can call the script and pass in the parameters, anyway?
Re: Can you give me a quick tutorial?
I'm still missing where to change this.
(Out comes the clue x four)
I have a screenshot of my project HERE
Nothing on the standard tool bar, or the debug tab.
Re: Can you give me a quick tutorial?
Go to Tools and then Options. On the left select Projects and Solutions. Then check the box to "Show advanced build configurations".
Now, you should have the build options.
You may not need to switch this to Release, but I don't know for sure and it is best to do it to be on the safe side.
Re: Can you give me a quick tutorial?
Aspnot:
THANK YOU SOOOO MUCH. Something so easy that was driving me absolutly bonkers.
It compiles and calls my vbs like a champ now! But it's choking on the argument. Wroks if I don't pass anything in, unhandled exception - cannot find file specified if i send in a path.
I'm using 'Command()' to return the command-line argument passed into the EXE file. The argument will be a path to a file. Any better way to do this?
..maybe I just need quotes around it. Trying that now.
Re: Can you give me a quick tutorial?
Nope. Still getting System cannot find the file specified.
I'm using:
Code:
Module Module1
Sub Main()
'DEBUG MESSAGE - Show what you're doing next...
Dim FileName As String
FileName = Command()
MsgBox("Calling " & "C:\test.vbs" & " " & Chr(34) & FileName & Chr(34))
'CALL THE SCRIPT WITH THIS EXE's COMMAND LINE ARGUMENT
Process.Start("C:\test.vbs" & " " & Chr(34) & FileName & Chr(34))
End Sub
End Module
And I know C:\test.vbs and c:\archives[1].zip exist.
Re: Can you give me a quick tutorial?
Do it this way: (I ran into the exact same thing today.)
VB Code:
Process.Start("C:\Test.vbs", FileName)
Re:[RESOLVED] Can you give me a quick tutorial?
Aspnot:
Thank you again so much for all your help.
I has actually just figured it out. But without your help earlier I would still be stuck throwing things because I couldn't get the thing built into an EXE.
I ended up using:
Code:
Dim myprocess As New System.Diagnostics.Process()
myprocess.StartInfo.FileName = "C:\script.vbs"
myprocess.StartInfo.Arguments = Command()
myprocess.Start()
Re: Can you give me a quick tutorial?
Congrats. It's always nice to get something off of your to-do list.