473,322 Members | 1,523 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

How do I execute dos command without a path

The process and execute methods want a path to the executable otherwise
they kick out a file not found. So how can I execute the following. It
works fine from a command window.

echo password| gpg.exe --yes --output c:\working\inbound\test.txt
--passphrase 0 -d c:\working\inbound\anstest.gpg

Nov 21 '05 #1
6 5978
PAPutzback wrote:
The process and execute methods want a path to the executable otherwise
they kick out a file not found. So how can I execute the following. It
works fine from a command window.

echo password| gpg.exe --yes --output c:\working\inbound\test.txt
--passphrase 0 -d c:\working\inbound\anstest.gpg


change your current dir to the dir where gpg.exe is residing.

--
Rinze van Huizen
C-Services Holland b.v.
Nov 21 '05 #2
"PAPutzback" <ph**************@insightbb.com> schrieb:
The process and execute methods want a path to the executable otherwise
they kick out a file not found. So how can I execute the following. It
works fine from a command window.

echo password| gpg.exe --yes --output c:\working\inbound\test.txt
--passphrase 0 -d c:\working\inbound\anstest.gpg


Are you sure you specified everything after "pgp.exe" in the
'ProcessStartInfo''s 'Arguments' property instead of appending it to the
'FileName' property?

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #3
Herfried K. Wagner [MVP] wrote:
"PAPutzback" <ph**************@insightbb.com> schrieb:
The process and execute methods want a path to the executable otherwise
they kick out a file not found. So how can I execute the following. It
works fine from a command window.

echo password| gpg.exe --yes --output c:\working\inbound\test.txt
--passphrase 0 -d c:\working\inbound\anstest.gpg

Are you sure you specified everything after "pgp.exe" in the
'ProcessStartInfo''s 'Arguments' property instead of appending it to the
'FileName' property?


No arguments -Error: cannot find file specified
System.Environment.CurrentDirectory = "c:\gnupg"
GPGProcess.StartInfo.WorkingDirectory = "c:\gnupg"
GPGProcess.StartInfo.FileName = "echo little boy blue| gpg"
GPGProcess.StartInfo.CreateNoWindow = True
GPGProcess.StartInfo.UseShellExecute = False
GPGProcess.Start()

No space between pipe and the exectuble = same error

Add .exe = same error

Add the full path "echo little boy blue| c:\gnupg\gpg.exe" = same error

Paste this into a cmd window

C:\gnupg>echo little boy blue| c:\gnupg\gpg.exe
gpg: no valid OpenPGP data found.
gpg: processing message failed: eof

I know the command is valid and this variation works also
C:\gnupg>echo little boy blue| gpg.exe
gpg: no valid OpenPGP data found.
gpg: processing message failed: eof

And also
C:\gnupg>echo little boy blue| gpg
gpg: no valid OpenPGP data found.
gpg: processing message failed: eof

Put the arguments on
C:\gnupg>echo little boy blue| gpg --passphrase-fd 0 -d c:\gnupg\anstest.gpg
Reading passphrase from file descriptor 0

You need a passphrase to unlock the secret key for
user: "Indiana Prohealth <ad***@ecommunity.com>"
1024-bit ELG-E key, ID 778EBE0E, created 2004-12-07 (main key ID FA28FB8B)

gpg: encrypted with 1024-bit ELG-E key, ID 778EBE0E, created 2004-12-07
"Indiana Prohealth <ad***@ecommunity.com>"
This is a test of the emergency broadcast system...

BEEEEEEEEEEEEEEEEEEEEEEEPPPPPPPPPPPPPPPPPP!!!!!

Testing 1,2,3...

Testing 1,2,3...

Testing 1,2,3...

Testing 1,2,3...

Testing 1,2,3...

And it all works.

Is there not a straight up way to fire off a command like you were in
the command window?

I appreciate your help with this because I am really stressed about
this. It is the final link in an app I need to finish.

Nov 21 '05 #4
PAPutzback wrote:
Herfried K. Wagner [MVP] wrote:
"PAPutzback" <ph**************@insightbb.com> schrieb:
The process and execute methods want a path to the executable otherwise
they kick out a file not found. So how can I execute the following. It
works fine from a command window.

echo password| gpg.exe --yes --output c:\working\inbound\test.txt
--passphrase 0 -d c:\working\inbound\anstest.gpg


Are you sure you specified everything after "pgp.exe" in the
'ProcessStartInfo''s 'Arguments' property instead of appending it to
the 'FileName' property?


No arguments -Error: cannot find file specified
System.Environment.CurrentDirectory = "c:\gnupg"
GPGProcess.StartInfo.WorkingDirectory = "c:\gnupg"
GPGProcess.StartInfo.FileName = "echo little boy blue| gpg"
GPGProcess.StartInfo.CreateNoWindow = True
GPGProcess.StartInfo.UseShellExecute = False
GPGProcess.Start()

No space between pipe and the exectuble = same error

Add .exe = same error

Add the full path "echo little boy blue| c:\gnupg\gpg.exe" = same error

Paste this into a cmd window

C:\gnupg>echo little boy blue| c:\gnupg\gpg.exe
gpg: no valid OpenPGP data found.
gpg: processing message failed: eof

I know the command is valid and this variation works also
C:\gnupg>echo little boy blue| gpg.exe
gpg: no valid OpenPGP data found.
gpg: processing message failed: eof

And also
C:\gnupg>echo little boy blue| gpg
gpg: no valid OpenPGP data found.
gpg: processing message failed: eof

Put the arguments on
C:\gnupg>echo little boy blue| gpg --passphrase-fd 0 -d
c:\gnupg\anstest.gpg
Reading passphrase from file descriptor 0

You need a passphrase to unlock the secret key for
user: "Indiana Prohealth <ad***@ecommunity.com>"
1024-bit ELG-E key, ID 778EBE0E, created 2004-12-07 (main key ID FA28FB8B)

gpg: encrypted with 1024-bit ELG-E key, ID 778EBE0E, created 2004-12-07
"Indiana Prohealth <ad***@ecommunity.com>"
This is a test of the emergency broadcast system...

BEEEEEEEEEEEEEEEEEEEEEEEPPPPPPPPPPPPPPPPPP!!!!!

Testing 1,2,3...

Testing 1,2,3...

Testing 1,2,3...

Testing 1,2,3...

Testing 1,2,3...

And it all works.

Is there not a straight up way to fire off a command like you were in
the command window?

I appreciate your help with this because I am really stressed about
this. It is the final link in an app I need to finish.


Now without the echo command
System.Environment.CurrentDirectory = "c:\gnupg"
GPGProcess.StartInfo.WorkingDirectory = "c:\gnupg"
GPGProcess.StartInfo.FileName = "gpg.exe"

GPGProcess.StartInfo.CreateNoWindow = True
GPGProcess.StartInfo.UseShellExecute = False
GPGProcess.Start()

No errors and the gpg process is running in Task manager

With the arguments
GPGProcess.StartInfo.Arguments = "--yes --output c:\gnupg\test.txt
--passphrase-fd 0 < c:\gnupg\gpg\password.txt --decrypt
c:\gnupg\anstest.gpg"

It is running in task manager but it did not create the file

If I change GPGProcess.StartInfo.CreateNoWindow = false
I get this and it just hangs there.
Reading passphrase from file descriptor 0 ...
If I change the arguments to
GPGProcess.StartInfo.Arguments = "--yes --output c:\gnupg\test.txt
--decrypt c:\gnupg\anstest.gpg"

I get the passphrase prompt

If I add
GPGProcess.StartInfo.RedirectStandardInput = True
GPGProcess.Start()
GPGProcess.StandardInput.Write("little boy blue")
GPGProcess.StandardInput.Flush()
GPGProcess.StandardInput.Close()

It still hangs at the passphrase prompt

-Phil

Nov 21 '05 #5
"PAPutzback" <Ph**************@insightbb.com> schrieb:
The process and execute methods want a path to the executable otherwise
they kick out a file not found. So how can I execute the following. It
works fine from a command window.

echo password| gpg.exe --yes --output c:\working\inbound\test.txt
--passphrase 0 -d c:\working\inbound\anstest.gpg


Are you sure you specified everything after "pgp.exe" in the
'ProcessStartInfo''s 'Arguments' property instead of appending it to the
'FileName' property?


No arguments -Error: cannot find file specified
System.Environment.CurrentDirectory = "c:\gnupg"
GPGProcess.StartInfo.WorkingDirectory = "c:\gnupg"
GPGProcess.StartInfo.FileName = "echo little boy blue| gpg"
GPGProcess.StartInfo.CreateNoWindow = True
GPGProcess.StartInfo.UseShellExecute = False
GPGProcess.Start()

No space between pipe and the exectuble = same error

Add .exe = same error

Add the full path "echo little boy blue| c:\gnupg\gpg.exe" = same error

Paste this into a cmd window

C:\gnupg>echo little boy blue| c:\gnupg\gpg.exe
gpg: no valid OpenPGP data found.
gpg: processing message failed: eof

I know the command is valid and this variation works also
C:\gnupg>echo little boy blue| gpg.exe
gpg: no valid OpenPGP data found.
gpg: processing message failed: eof

And also
C:\gnupg>echo little boy blue| gpg
gpg: no valid OpenPGP data found.
gpg: processing message failed: eof

Put the arguments on
C:\gnupg>echo little boy blue| gpg --passphrase-fd 0 -d
c:\gnupg\anstest.gpg
Reading passphrase from file descriptor 0

You need a passphrase to unlock the secret key for
user: "Indiana Prohealth <ad***@ecommunity.com>"
1024-bit ELG-E key, ID 778EBE0E, created 2004-12-07 (main key ID FA28FB8B)

gpg: encrypted with 1024-bit ELG-E key, ID 778EBE0E, created 2004-12-07
"Indiana Prohealth <ad***@ecommunity.com>"
This is a test of the emergency broadcast system...

BEEEEEEEEEEEEEEEEEEEEEEEPPPPPPPPPPPPPPPPPP!!!!!

Testing 1,2,3...

Testing 1,2,3...

Testing 1,2,3...

Testing 1,2,3...

Testing 1,2,3...

And it all works.

Is there not a straight up way to fire off a command like you were in the
command window?


'ECHO' is actually a command of the command shell ("CMD.EXE"). So you will
have to run "CMD.EXE" with the rest as parameter (or take a look at the
sample I already referenced in a previous post).

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #6
Herfried K. Wagner [MVP] wrote:
"PAPutzback" <Ph**************@insightbb.com> schrieb:
The process and execute methods want a path to the executable otherwise
they kick out a file not found. So how can I execute the following. It
works fine from a command window.

echo password| gpg.exe --yes --output c:\working\inbound\test.txt
--passphrase 0 -d c:\working\inbound\anstest.gpg
Are you sure you specified everything after "pgp.exe" in the
'ProcessStartInfo''s 'Arguments' property instead of appending it to
the 'FileName' property?

No arguments -Error: cannot find file specified
System.Environment.CurrentDirectory = "c:\gnupg"
GPGProcess.StartInfo.WorkingDirectory = "c:\gnupg"
GPGProcess.StartInfo.FileName = "echo little boy blue| gpg"
GPGProcess.StartInfo.CreateNoWindow = True
GPGProcess.StartInfo.UseShellExecute = False
GPGProcess.Start()

No space between pipe and the exectuble = same error

Add .exe = same error

Add the full path "echo little boy blue| c:\gnupg\gpg.exe" = same error

Paste this into a cmd window

C:\gnupg>echo little boy blue| c:\gnupg\gpg.exe
gpg: no valid OpenPGP data found.
gpg: processing message failed: eof

I know the command is valid and this variation works also
C:\gnupg>echo little boy blue| gpg.exe
gpg: no valid OpenPGP data found.
gpg: processing message failed: eof

And also
C:\gnupg>echo little boy blue| gpg
gpg: no valid OpenPGP data found.
gpg: processing message failed: eof

Put the arguments on
C:\gnupg>echo little boy blue| gpg --passphrase-fd 0 -d
c:\gnupg\anstest.gpg
Reading passphrase from file descriptor 0

You need a passphrase to unlock the secret key for
user: "Indiana Prohealth <ad***@ecommunity.com>"
1024-bit ELG-E key, ID 778EBE0E, created 2004-12-07 (main key ID
FA28FB8B)

gpg: encrypted with 1024-bit ELG-E key, ID 778EBE0E, created 2004-12-07
"Indiana Prohealth <ad***@ecommunity.com>"
This is a test of the emergency broadcast system...

BEEEEEEEEEEEEEEEEEEEEEEEPPPPPPPPPPPPPPPPPP!!!!!

Testing 1,2,3...

Testing 1,2,3...

Testing 1,2,3...

Testing 1,2,3...

Testing 1,2,3...

And it all works.

Is there not a straight up way to fire off a command like you were in
the command window?

'ECHO' is actually a command of the command shell ("CMD.EXE"). So you
will have to run "CMD.EXE" with the rest as parameter (or take a look at
the sample I already referenced in a previous post).

Thanks for the code. I am on my way out but I plugged the entire line
into the textbox and it worked. So I'll pull what I need out of it.

Thanks again,
Phil
Nov 21 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Robert | last post by:
I am using the php4-cgi Debian package which is based on PHP 4.3.4. I have problems when running php4 on the command line. If I say something like $ php4 index.cgi a number of variables...
8
by: wj | last post by:
Hi all, I wonder if it is possible to execute PHP-code automatically. Is it for example possible to sent an e-mail every day at lets say 9.00 pm automatically to adresses from a database? ...
3
by: Bob Garbados | last post by:
I'm pretty new to php\linux and I'm trying to encrypt a file using gpg from a php page on a linux box and it's not working. The following code works for executing 'ls', but not gpg... ...
4
by: Kartik | last post by:
Hi, I have an ASP.NET application using VB.NET.I am sending a DOS command to a machine on the network to print a file. This is achieved using xp_cmdshell Dim str As String = "xp_cmdshell...
15
by: Madhanmohan S | last post by:
Hi All, I want to run a command line appplication from C#. When i start the application, it will go into specific mode. After that, i have to give commands to use the application. How Can This Be...
6
by: nsjmetzger | last post by:
I have a script that runs fine in Windows 2003 (32-bit). It basically calls the Windows defrag command. When I try the exact same code on Windows 2003 (64-bit) I get the following message: ...
15
by: tmp123 | last post by:
Hello, Thanks for your time. We have very big files with python commands (more or less, 500000 commands each file). It is possible to execute them command by command, like if the commands...
23
by: ticfranca | last post by:
Hi, I'm getting this error in the code below: sub Pega_recorde { $database = 'bundinha'; $host = 'localhost'; $usuario = 'myhumoradm'; $senha = 'my8xr2d2'; ...
6
by: Oliver | last post by:
I'm fairly new to DB2. I have been assigned to build a delete trigger that finds the data type of each of the table's fields so that the trigger can then build a string consisting of OLD values...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.