473,738 Members | 8,397 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

close cmd window when process.startin fo closes

I'm opening a cmd window to run an ftp process. It's easy enough to close the
process (.close()), but the cmd window won't close unless I go out to the
window and type 'quit'.

How can I send a request to the cmd window to close?

Here's the code snippet that I'm using to make the call:

string strArg = "/c ftp.exe -v -n -s:" + strFile + " " + strHost + " > " +
strLogFile;
Process ftpProcess = new Process();
ftpProcess.Star tInfo.FileName= "cmd.exe";
ftpProcess.Star tInfo.Arguments = strArg;
ftpProcess.Star tInfo.CreateNoW indow=true;
ftpProcess.Star t();

Below this line in the code I've tried a number of things, but they all
target the process and not the cmd window itself. The ftp process completes
successfully in just over a second.

thanks for any help.

Feb 24 '06 #1
2 5121
Hi David,
do you want to show the command window at all, would keeping it hidden all
the time be acceptable? If so then you can set the WindowStyle property of
the ProcessStartInf o to Hidden and the command window will execute but won't
be displayed.

System.Diagnost ics.ProcessStar tInfo pi;
pi.WindowStyle = System.Diagnost ics.ProcessWind owStyle.Hidden

Mark Dawson
http://www.markdawson.org
"David" wrote:
I'm opening a cmd window to run an ftp process. It's easy enough to close the
process (.close()), but the cmd window won't close unless I go out to the
window and type 'quit'.

How can I send a request to the cmd window to close?

Here's the code snippet that I'm using to make the call:

string strArg = "/c ftp.exe -v -n -s:" + strFile + " " + strHost + " > " +
strLogFile;
Process ftpProcess = new Process();
ftpProcess.Star tInfo.FileName= "cmd.exe";
ftpProcess.Star tInfo.Arguments = strArg;
ftpProcess.Star tInfo.CreateNoW indow=true;
ftpProcess.Star t();

Below this line in the code I've tried a number of things, but they all
target the process and not the cmd window itself. The ftp process completes
successfully in just over a second.

thanks for any help.

Feb 24 '06 #2
thanks for replying.
I did have that set, and once I get this working, I'll set it again.
Unfortunately, having it hidden isn't good enough, because it's still not
closed, and if I later try to access the file that the process creates, I get
an error stating that the file is being used by another application.
"Mark R. Dawson" wrote:
Hi David,
do you want to show the command window at all, would keeping it hidden all
the time be acceptable? If so then you can set the WindowStyle property of
the ProcessStartInf o to Hidden and the command window will execute but won't
be displayed.

System.Diagnost ics.ProcessStar tInfo pi;
pi.WindowStyle = System.Diagnost ics.ProcessWind owStyle.Hidden

Mark Dawson
http://www.markdawson.org
"David" wrote:
I'm opening a cmd window to run an ftp process. It's easy enough to close the
process (.close()), but the cmd window won't close unless I go out to the
window and type 'quit'.

How can I send a request to the cmd window to close?

Here's the code snippet that I'm using to make the call:

string strArg = "/c ftp.exe -v -n -s:" + strFile + " " + strHost + " > " +
strLogFile;
Process ftpProcess = new Process();
ftpProcess.Star tInfo.FileName= "cmd.exe";
ftpProcess.Star tInfo.Arguments = strArg;
ftpProcess.Star tInfo.CreateNoW indow=true;
ftpProcess.Star t();

Below this line in the code I've tried a number of things, but they all
target the process and not the cmd window itself. The ftp process completes
successfully in just over a second.

thanks for any help.

Feb 24 '06 #3

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

Similar topics

6
8537
by: chon | last post by:
I have an ASP page that is sent a file location as a parameter. It opens this file, loads the ADODB.Stream object and does a binary write to the page forcing the download dialog to appear. This all works fine. If the user selects "Open" or "Cancel", the window closes, which is the desired behavior. If they select "Save", the location dialog shows up, they save the file and the window remains open. I've tried a number of things to get...
1
3370
by: gopal srinivasan | last post by:
I need to know how to close a parent modal window when child modal window opens, also i need to know the syntax for writing document on the modal window on the fly, like what we do in case of normal window. Actually, I tried to close the parent window from the child modal window using parent.close syntax in onload event in child modal window. It actually closes the parent modal window, but the child modal window is not opened, why it is...
6
5674
by: clequieu | last post by:
I have created a form. Within the form is a button to close the window on click and to validate as well. The close window works when it is a stand alone, but it does not work when it is embedded with the other code. Here is the code I am currently using: <p><font face="Trebuchet MS"> <input type="submit" value="Send" name="B1" onClick="Javascript:window.close()" "MM_validateForm('Manager Name','','R','Managers...
3
1714
by: mcyi2mr3 | last post by:
Hi all I'm new to javascript and im trying to add a close button function to my certain pages of my site. I use this code: <a href='javascript:window.close();'>Close Window</a> to create a hyperlink which closes the window. However with pages which display data retrieved from a database using PHP i use a form to submit a search on the page which displays results. At the bottom of the page
2
1817
by: tomko | last post by:
Hi, My program uses the Process class to start a bat file that starts an exe. When I run my program inside Visual Studio (debug) the bat and exe run in the background (are not visible) and all their output is redirected to my stream reader. But when I try to run my program outside the IDE, the exe starts in it's own window and my prgram is put on hold. When I exit the started program the output of the bat is flushed to my stream.
2
3591
by: Alan T | last post by:
I use Process.StartInfo to configure the process: Process myProcess = new Process(); myProcess.StartInfo.FileName = aProg; myProcess.StartInfo.Arguments = aArgument; myProcess.StartInfo.CreateNoWindow = true;
4
1931
by: ceh | last post by:
Hi, I'm using c# vs 2005 win xp pro sp2. I create a cmd prompt with pInvoke via CreateProcessWithLogonW Taskmgr shows that cmd instance running as that user. I type set in that cmd window and it shows me the env vars. Most importantly, it also shows a custom env var I have set. Later, I open that proc via StringDictionary env = myProcess.StartInfo.EnvironmentVariables; I look at this value in the debugger and all it over shows me is...
2
2274
by: svbc | last post by:
Hi, I am facing a problem with refreshing parent: Parent window : A From A I am opening a child window B using window.open("","EVENT_DETAILS_WINDOW","height=310,width=480,top=150,left=200,status=yes,resizable=yes,scrollbars=yes"); form.target="EVENT_DETAILS_WINDOW"; form.action= "event.jsp" form.submit(); From B I am opening a another window C and closing window B the code..
4
3994
by: =?Utf-8?B?SHVleQ==?= | last post by:
I need to hide the new window started from the code below. If I run as is, the window is visible. If I comment out the code that sets a different user, domain, and password the window is hidden as desired. Does anyone know if there is a known issue with hiding a process window when you run it as a different user? Do you have any suggestions to work around this problem? Thank you. Process proc = new Process();...
0
8788
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,...
0
9476
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9263
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
9208
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
8210
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...
1
6751
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4825
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2745
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2193
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.