Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

put variable contents to a command prompt

Status
Not open for further replies.

tazbrown

Programmer
Feb 13, 2002
7
0
0
US
I am having a real problem figuring out how to use the putstring command in a shell.

progid = Shell("cmd.exe", vbNormalFocus)

I am looking to take a variable and insert it onto the current line of the command prompt. Can anyone help?

Greg
 
Hi Greg:

Your solution might be something like:
{code]
progid = Shell("cmd.exe " & varMyVariable, vbNormalFocus)
[/code]

Per the MSDN Library, the first paramater to the Shell function ("pathname") is described as"
[highlight]
pathname Required; Variant (String). Name of the program to execute and any required arguments or command-line switches; may include directory or folder and drive.
[/highlight]

HTH,
Cassandra
 

progid = Shell("cmd.exe " & varname, vbNormalFocus)

I assume this is what you're looking for...
 
kindof......I am calling the command prompt, I do a sendkeys function to start an ftp program......after this I am prompted for a username and password which was asked for earlier in the VB programming. can I still use the username and password by putting it in the shell command?
 
Generate a .BAT file in the VB prog, then shell to that

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Essex Steam UK for steam enthusiasts
 
Do a keyword search on 'console' in this forum. There are a number of approaches covered, from the relatively trivial (leveraging the script host's ability to read and write STDIN and STDOUT) to the relatively complex, involving allocation of a console window, redirection of inherited redirection of STDIN and STDOUT, and self-patching the compiled EXE ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top