Hello all =)
I am working on a Visual Basics (6) project that requires a hidden command prompt window, to which I need to pass commands.
I need to:
- Open a hidden command prompt
- CD to a directory
- pass a command including several file names
- Exit the hidden window
I have no idea how to start doing this. I have tried with the following code, but nothing is working for me (I am using Visual Basics Express 2010; VB6). Any help with this will be very much appreciated.
Code I am currently toying with:
Dim WSH
WSH = CreateObject("WScript.Shell")
WSH.Run("cmd", 0)
WSH.Send(cdcommand)
WSH.Send(MencoderCommand)
WSH.Send("exit")
WSH = Nothing
Which doesn't work, and
Dim WSH
WSH = CreateObject("WScript.Shell")
WSH.Run(cdcommand & "/K" & MencoderCommand & "/K" & " exit /K", 0, 1)
WSH = Nothing
No go.
Dim objShell
objShell = CreateObject("WScript.Shell")
WScript.Echo(objShell.CurrentDirectory)
objShell.CurrentDirectory = cdcommand
objShell.Run(MencoderLocation & "/k" & MencoderCommand & " /k exit", 0, 1)
which still doesn't work, and finally
Dim MenCoder
OpenMencoder = Shell("cmd.exe", AppWinStyle.NormalFocus)
SendKeys.Send(cdcommand)
SendKeys.Send(ControlChars.NewLine)
SendKeys.Send(MencoderCommand)
SendKeys.Send(ControlChars.NewLine)
SendKeys.Send("exit")
SendKeys.Send(ControlChars.NewLine)
Which, predictably, did not work well at all.
cdcommand = the the variable containing "cd PATH_TO_CD_TO", and MencoderCommand = the main command I'm trying to pass the command prompt.
Thanks!