MHC_bcraigh
asked on
How to use different "shell" with Shell() in VB.net
I am working on a program that needs to call a 3rd party shell from my VB.NET code. I have been trying to use the Shell() function but apparently the 3rd party shell I need to use doesn't work correctly when I call it from the default shell. Is there a way in VB.NET I can either see the code for the built-in Shell() function so I can re-write it to use my other shell or call this other shell directly?
Here's what I'm trying to do, I am working on a program to work with CA Autosys 4.5 (a job scheduler) which creates jobs in Autosys when certain things happen. I am doing this by creating a temporary file containing JIL script (the scripting language used by Autosys) with my VB.NET code. Then I need to be able to do the command "jil.exe < tempfile.jil" from within the Autosys shell, which is called "initautosys.exe" If I call the Autosys shell from Shell("initautosys.exe -i ACE -r jil.exe < tempfile.jil"), it works up to "initautosys.exe -i ACE -r jil.exe" but never gets the "< tempfile.jil". CA tells me that I have to call initautosys.exe directly and not from the default shell.
So does anyone know a good way to handle this? I could either write my own shell function (like maybe CAshell()) if I had a way to see how the regular Shell() function is written, or I could see if there was a way to run the Autosys shell directly. Any idea???
Here's what I'm trying to do, I am working on a program to work with CA Autosys 4.5 (a job scheduler) which creates jobs in Autosys when certain things happen. I am doing this by creating a temporary file containing JIL script (the scripting language used by Autosys) with my VB.NET code. Then I need to be able to do the command "jil.exe < tempfile.jil" from within the Autosys shell, which is called "initautosys.exe" If I call the Autosys shell from Shell("initautosys.exe -i ACE -r jil.exe < tempfile.jil"), it works up to "initautosys.exe -i ACE -r jil.exe" but never gets the "< tempfile.jil". CA tells me that I have to call initautosys.exe directly and not from the default shell.
So does anyone know a good way to handle this? I could either write my own shell function (like maybe CAshell()) if I had a way to see how the regular Shell() function is written, or I could see if there was a way to run the Autosys shell directly. Any idea???
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I liked the suggestion to create a process like:
Dim oCmd As New Process
Dim ascmd As String = "C:\Progra~1\CA\UnicenterA
Dim jilstr As String = "-i ACE -r " & """" & "C:\Progra~1\CA\UnicenterA
oCmd.StartInfo.WorkingDire
oCmd.StartInfo.UseShellExe
oCmd.StartInfo.FileName = ascmd
oCmd.StartInfo.Arguments = jilstr
oCmd.EnterDebugMode() 'used for debugging purposes
oCmd.Start()
but I got the same result as using Shell().
I'm going to abandon this idea since there doesn't appear to be a way around the limitations of Autosys without re-writing Autosys. I am going to create all of my jobs in Autosys to be permanent jobs for now so I can at least get something working, then I will re-visit this at a later time and just write something to do what I thought Autosys should have been able to do. Maybe we can sell the solution to other Autosys shops!?!?! kidding.......