Greetings everyone - I have a question for the VB6 folks in the room.
I am trying to build a Shell command that will execute a command line application and write the results of the command to a text file. Now, in DOS this is easy, I just add >>FilePath\Filename.txt to the end of the command, and viola! instant results file.
Apparently it's not that easy in VB.
Here's the code I am using:
If boolAllowLogin Then
'1. Assign values to global variables
gstrDepServer = ReadINIKey("servers", cmbEnvironment, "C:\Data\bmui.ini")
gstrUser = txtUserName
gstrPwd = txtPassword
'2. Check to see if the user has rights on the environment
strFileName = "C:\Data\LoginResults.txt"
strShellCmd = "bundlemgr"
strShellCmd = strShellCmd & " -ds " & gstrDepServer
strShellCmd = strShellCmd & " -u " & gstrUser
strShellCmd = strShellCmd & " -pwd " & gstrPwd
strShellCmd = strShellCmd & " -c list"
strShellCmd = strShellCmd & ">>" & strFileName
I have set breakpoints and watched the code run through, it does build and execute the Shell Command, so I know the flag is getting set correctly, but the results file never gets created. If I take the text that gets built above and paste it into a command line, it executes correctly and creates the file I expect to see, so I know the base syntax is correct. I just can't seem to make VB do it correctly. Am I missing something here?