Board index » Visual Studio » Can someone help me?

Can someone help me?

Visual Studio232
I am using a command line visual basic

I would like to have code that reads in some arguments These arguments

are then passed to another program to run.



Why is it that it doesnt work when I compile the following? I am hoping

to that on execution, the file test.bat will run!



Module1

Sub Main()

Shell.Execute "C:\xyz\TEST.BAT"

End Sub

End Module



I have confirmed that xyz etc are all valid paths!



If this works, then I can extend it so that TEST.BAT becomes and input

argument separately but so far it doesnt work and complains that I

havent declared Shell



I am very very new to VB and hope someone can give me advice.


-
 

Re:Can someone help me?



<atmkoh@yahoo.co.uk>wrote in message

Quote
I am using a command line visual basic

I would like to have code that reads in some arguments These arguments

are then passed to another program to run.



Why is it that it doesnt work when I compile the following? I am hoping

to that on execution, the file test.bat will run!



Module1

Sub Main()

Shell.Execute "C:\xyz\TEST.BAT"

End Sub

End Module



I have confirmed that xyz etc are all valid paths!



If this works, then I can extend it so that TEST.BAT becomes and input

argument separately but so far it doesnt work and complains that I

havent declared Shell



I am very very new to VB and hope someone can give me advice.





What version of Visual Basic are you using? Classic VB (VB6 and lower) or

that other thing?



There is no "Shell" object in VB, it is a function, so you would just use...

Shell "C:\xyz\test.bat"

(but there may be other issues:

http://groups.google.com/group/microsoft.public.vb.general.discussion/browse_frm/thread/8272bfc38f462d99/d9b5cd3f5a559963?lnk" rel="nofollow" target="_blank">groups.google.com/group/microsoft.public.vb.general.discussion/browse_frm/thread/8272bfc38f462d99/d9b5cd3f5a559963=st&q=shell+comspec++group%3Amicrosoft.public.vb.general.discussion+author%3ARick+author%3ARothstein&rnum=4&hl=en#d9b5cd3f5a559963

)



If you are using VB.Fred then you need to post this message in a dotnet

newsgroup.



hth

-ralph





-

Re:Can someone help me?

When you say Command line Visual basic; do you mean an ActiveX exe application?

(Executable program without forms basically.)



anyway, you can normally get the command line arguments from "Command" in

your start sub for VB classic applications.



Ex. (If Sub Main is your start sub)

Sub Main

Dim Arg1 as Boolean



If Instr(1, lcase(Command), "dodebug")>0 then

Arg1 = True

Else

Arg1 = False

End if





...



End Sub





Kjell



"atmkoh@yahoo.co.uk" wrote:



Quote
I am using a command line visual basic

I would like to have code that reads in some arguments These arguments

are then passed to another program to run.



Why is it that it doesnt work when I compile the following? I am hoping

to that on execution, the file test.bat will run!



Module1

Sub Main()

Shell.Execute "C:\xyz\TEST.BAT"

End Sub

End Module



I have confirmed that xyz etc are all valid paths!



If this works, then I can extend it so that TEST.BAT becomes and input

argument separately but so far it doesnt work and complains that I

havent declared Shell



I am very very new to VB and hope someone can give me advice.





-

Re:Can someone help me?

<atmkoh@yahoo.co.uk>wrote in message



Quote
Module1

[...]

End Module



This is a VB "classic" newsgroup. Questions about VB.NET (including VB 2005,

which has dropped .NET from its name) are off-topic here.



Please ask .NET questions in newsgroups with "dotnet" in their names. The

*.vb.* groups are for VB6 and earlier. If you don't see the *.dotnet.*

groups on your news server, connect directly to the Microsoft server:

msnews.microsoft.com.





-