473,890 Members | 1,885 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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\inbo und\test.txt
--passphrase 0 -d c:\working\inbo und\anstest.gpg

Nov 21 '05 #1
6 6014
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\inbo und\test.txt
--passphrase 0 -d c:\working\inbo und\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.co m> 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\inbo und\test.txt
--passphrase 0 -d c:\working\inbo und\anstest.gpg


Are you sure you specified everything after "pgp.exe" in the
'ProcessStartIn fo''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.co m> 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\inbo und\test.txt
--passphrase 0 -d c:\working\inbo und\anstest.gpg

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


No arguments -Error: cannot find file specified
System.Environm ent.CurrentDire ctory = "c:\gnupg"
GPGProcess.Star tInfo.WorkingDi rectory = "c:\gnupg"
GPGProcess.Star tInfo.FileName = "echo little boy blue| gpg"
GPGProcess.Star tInfo.CreateNoW indow = True
GPGProcess.Star tInfo.UseShellE xecute = False
GPGProcess.Star t()

No space between pipe and the exectuble = same error

Add .exe = same error

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

Paste this into a cmd window

C:\gnupg>echo little boy blue| c:\gnupg\gpg.ex e
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\anstes t.gpg
Reading passphrase from file descriptor 0

You need a passphrase to unlock the secret key for
user: "Indiana Prohealth <ad***@ecommuni ty.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***@ecommuni ty.com>"
This is a test of the emergency broadcast system...

BEEEEEEEEEEEEEE EEEEEEEEEPPPPPP PPPPPPPPPPPP!!! !!

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.co m> 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\inbo und\test.txt
--passphrase 0 -d c:\working\inbo und\anstest.gpg


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


No arguments -Error: cannot find file specified
System.Environm ent.CurrentDire ctory = "c:\gnupg"
GPGProcess.Star tInfo.WorkingDi rectory = "c:\gnupg"
GPGProcess.Star tInfo.FileName = "echo little boy blue| gpg"
GPGProcess.Star tInfo.CreateNoW indow = True
GPGProcess.Star tInfo.UseShellE xecute = False
GPGProcess.Star t()

No space between pipe and the exectuble = same error

Add .exe = same error

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

Paste this into a cmd window

C:\gnupg>echo little boy blue| c:\gnupg\gpg.ex e
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\anstes t.gpg
Reading passphrase from file descriptor 0

You need a passphrase to unlock the secret key for
user: "Indiana Prohealth <ad***@ecommuni ty.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***@ecommuni ty.com>"
This is a test of the emergency broadcast system...

BEEEEEEEEEEEEEE EEEEEEEEEPPPPPP PPPPPPPPPPPP!!! !!

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.Environm ent.CurrentDire ctory = "c:\gnupg"
GPGProcess.Star tInfo.WorkingDi rectory = "c:\gnupg"
GPGProcess.Star tInfo.FileName = "gpg.exe"

GPGProcess.Star tInfo.CreateNoW indow = True
GPGProcess.Star tInfo.UseShellE xecute = False
GPGProcess.Star t()

No errors and the gpg process is running in Task manager

With the arguments
GPGProcess.Star tInfo.Arguments = "--yes --output c:\gnupg\test.t xt
--passphrase-fd 0 < c:\gnupg\gpg\pa ssword.txt --decrypt
c:\gnupg\anstes t.gpg"

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

If I change GPGProcess.Star tInfo.CreateNoW indow = false
I get this and it just hangs there.
Reading passphrase from file descriptor 0 ...
If I change the arguments to
GPGProcess.Star tInfo.Arguments = "--yes --output c:\gnupg\test.t xt
--decrypt c:\gnupg\anstes t.gpg"

I get the passphrase prompt

If I add
GPGProcess.Star tInfo.RedirectS tandardInput = True
GPGProcess.Star t()
GPGProcess.Stan dardInput.Write ("little boy blue")
GPGProcess.Stan dardInput.Flush ()
GPGProcess.Stan dardInput.Close ()

It still hangs at the passphrase prompt

-Phil

Nov 21 '05 #5
"PAPutzback " <Ph************ **@insightbb.co m> 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\inbo und\test.txt
--passphrase 0 -d c:\working\inbo und\anstest.gpg


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


No arguments -Error: cannot find file specified
System.Environm ent.CurrentDire ctory = "c:\gnupg"
GPGProcess.Star tInfo.WorkingDi rectory = "c:\gnupg"
GPGProcess.Star tInfo.FileName = "echo little boy blue| gpg"
GPGProcess.Star tInfo.CreateNoW indow = True
GPGProcess.Star tInfo.UseShellE xecute = False
GPGProcess.Star t()

No space between pipe and the exectuble = same error

Add .exe = same error

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

Paste this into a cmd window

C:\gnupg>echo little boy blue| c:\gnupg\gpg.ex e
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\anstes t.gpg
Reading passphrase from file descriptor 0

You need a passphrase to unlock the secret key for
user: "Indiana Prohealth <ad***@ecommuni ty.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***@ecommuni ty.com>"
This is a test of the emergency broadcast system...

BEEEEEEEEEEEEEE EEEEEEEEEPPPPPP PPPPPPPPPPPP!!! !!

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.co m> 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\inbo und\test.txt
--passphrase 0 -d c:\working\inbo und\anstest.gpg
Are you sure you specified everything after "pgp.exe" in the
'ProcessStartIn fo''s 'Arguments' property instead of appending it to
the 'FileName' property?

No arguments -Error: cannot find file specified
System.Environm ent.CurrentDire ctory = "c:\gnupg"
GPGProcess.Star tInfo.WorkingDi rectory = "c:\gnupg"
GPGProcess.Star tInfo.FileName = "echo little boy blue| gpg"
GPGProcess.Star tInfo.CreateNoW indow = True
GPGProcess.Star tInfo.UseShellE xecute = False
GPGProcess.Star t()

No space between pipe and the exectuble = same error

Add .exe = same error

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

Paste this into a cmd window

C:\gnupg>echo little boy blue| c:\gnupg\gpg.ex e
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\anstes t.gpg
Reading passphrase from file descriptor 0

You need a passphrase to unlock the secret key for
user: "Indiana Prohealth <ad***@ecommuni ty.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***@ecommuni ty.com>"
This is a test of the emergency broadcast system...

BEEEEEEEEEEEEEE EEEEEEEEEPPPPPP PPPPPPPPPPPP!!! !!

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
7694
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 are not initialized. For example, $HTTP_GET_VARS is not set. To get it set, here's my workaround:
8
3117
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? Thanx, WJ
3
7866
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... $descriptorspec = array( 0 => array("pipe", "r"), // stdin is a pipe that the child will read from 1 => array("pipe", "w"), // stdout is a pipe that the child will write to 2 => array("file", "/tmp/error-output.txt", "a") // stderr is a file to
4
9905
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 ""type " & nwkfilepath & " > " & pPrinterName & " """
15
14073
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 Done in C#.... Thanks and Regards, S.Madhanmohan
6
3811
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: C:\Scripts>autodefrag.py Starting defragment: defrag -v C: >>c:/Scripts/DEFRAG20070502.log 'defrag' is not recognized as an internal or external command, operable program or batch file. I have tried defrag.exe and even giving it the full path to
15
2835
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 was typed one after the other in a interactive session?
23
24592
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'; $dbh=DBI->connect("DBI:mysql:database=$database;host=$host","$usuario","$senha") or die "Can't open DB: $!";
6
4451
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 pre-wrapped in quote marks as needed. The deleted record's field values, all strung together as a single string, would then be inserted into a single archiving table (an architecture I inherited and cannot change). I've got the trigger doing...
0
9975
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9812
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10899
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10446
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9614
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5832
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6032
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4255
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3263
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.