Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ShellExecute problem

Posted on 1999-06-30
16
Medium Priority
?
256 Views
Last Modified: 2010-08-05
I need to call a 3rd party program and pipe a password to it. I can't use the echo command because this is not an executable that can be pointed to but is rather embedded in the command.com file. I have a tiny program called myecho.exe which will output the first argument passed to it. I have tried to use both Shell and ShellExecute but I'm having trouble piping a password? I know I can use a batch file and I've done this successfully but do not want to use a batch file that contains a password.

The command looks something like this...

result=Shell("myecho password|su.exe joe regedit bwcorg -w")
0
Comment
Question by:Kitsune
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 2
  • 2
  • +3
16 Comments
 
LVL 6

Expert Comment

by:clifABB
ID: 1521001
Shell to command.com passing your app and pipe.

Unfortunately I don't have time to test this, although it should work.
I am posting this as an answer.  If it does solve your problem, let me know and I'll repost as an answer.
0
 
LVL 1

Author Comment

by:Kitsune
ID: 1521002
Tried that. I thought it should have taken that as well.
0
 
LVL 12

Expert Comment

by:mark2150
ID: 1521003
Try:

SHELL ("COMMAND.COM /C ECHO password|su.exe ...")

M

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 2

Expert Comment

by:DavidMartin
ID: 1521004
Have you tried putting the input into a text file?

e.g
  su joe regedit bwcorg -w < password.txt

0
 
LVL 1

Author Comment

by:Kitsune
ID: 1521005
DavidMartin

Yes, redirecting from a text file works, of course, but then you still have the password in clear text. We have previously been using this method and are trying to get away from it. I want to keep the password within the code and not have it output to any text file, even temporarily.
0
 
LVL 6

Expert Comment

by:clifABB
ID: 1521006
Ok, here's a quick and dirty.
Create a text file with the password just before you call you external app and then delete it after.
0
 
LVL 2

Expert Comment

by:DavidMartin
ID: 1521007
How about creating a shell then using sendkeys to write to the command prompt
0
 
LVL 1

Author Comment

by:Kitsune
ID: 1521008
mark2150,

Thanks. This works just fine. I was not using the /c switch previously. Make this an answer and I'll credit you the points.
0
 
LVL 1

Author Comment

by:Kitsune
ID: 1521009
mark2150,

Thanks. This works just fine. I was not using the /c switch previously. Make this an answer and I'll credit you the points.
0
 
LVL 2

Expert Comment

by:SLE
ID: 1521010
Don't forget to use CMD instead of COMMAND on NT platforms.
0
 
LVL 1

Author Comment

by:Kitsune
ID: 1521011
mark2150,

Thanks. This works just fine. I was not using the /c switch previously. Make this an answer and I'll credit you the points.
0
 
LVL 1

Author Comment

by:Kitsune
ID: 1521012
SLE

Actually, although I type cmd from the Run command box to bring up a shell, in VB I can type command.com and it will work on NT as well as Win95/98.
0
 
LVL 3

Expert Comment

by:BGillham
ID: 1521013
For goodness sake everyone is over complicating things.
write the password to the a secured database or the registry
retreive it from the other program and delete it. If you want more security use a simple Encrypt / Decrypt routine.

0
 
LVL 1

Author Comment

by:Kitsune
ID: 1521014
mark2150,

We're waiting on you to post as an answer so you can receive the points. As far as I am concerned, this question has been answered to my satisfaction.
0
 
LVL 12

Accepted Solution

by:
mark2150 earned 80 total points
ID: 1521015
Sorry about the delay in posting an answer. I was on vacation. Unlike the advert's on TV, I do *NOT* take a 'puter with me to the beach! What a *silly* concept! I'm on vacation to get *away* from 'puters for a bit, *WHY* would anyone take their laptop, cell phone, etc on *VACATION*?

Thanx for the pts!

M

0
 
LVL 1

Author Comment

by:Kitsune
ID: 1521016
Thanks Mark
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question