473,408 Members | 2,832 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,408 software developers and data experts.

net view not creating txt file

The following dos command creates a text file of all active computers
in the domain:

net view > c:\test.txt

However the following code does not create the text file. Any idea why
this is? The command executes, but it doesn't create the file.

ProcessStartInfo qOptions = new ProcessStartInfo("net",
"view > c:\\test.txt");

qOptions.UseShellExecute = true;
qOptions.WindowStyle = ProcessWindowStyle.Minimized;
DOS = Process.Start(qOptions);
DOS.WaitForExit();
Nov 16 '05 #1
4 1652
Greg <g8*******@msn.com> wrote:
The following dos command creates a text file of all active computers
in the domain:

net view > c:\test.txt

However the following code does not create the text file. Any idea why
this is? The command executes, but it doesn't create the file.

ProcessStartInfo qOptions = new ProcessStartInfo("net",
"view > c:\\test.txt");

qOptions.UseShellExecute = true;
qOptions.WindowStyle = ProcessWindowStyle.Minimized;
DOS = Process.Start(qOptions);
DOS.WaitForExit();


">" is a command shell feature. You could start cmd or command
(depending on OS) with appropriate parameters, but it's probably better
to just start a new thread to write the file yourself from the output.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2
Jon Skeet [C# MVP] <sk***@pobox.com> wrote in message news:<MP************************@msnews.microsoft. com>...
Greg <g8*******@msn.com> wrote:
The following dos command creates a text file of all active computers
in the domain:

net view > c:\test.txt

However the following code does not create the text file. Any idea why
this is? The command executes, but it doesn't create the file.

ProcessStartInfo qOptions = new ProcessStartInfo("net",
"view > c:\\test.txt");

qOptions.UseShellExecute = true;
qOptions.WindowStyle = ProcessWindowStyle.Minimized;
DOS = Process.Start(qOptions);
DOS.WaitForExit();


">" is a command shell feature. You could start cmd or command
(depending on OS) with appropriate parameters, but it's probably better
to just start a new thread to write the file yourself from the output.

What would the parameters be for 'cmd' to accomplish this?
Alternatively, what would the syntax be for the new thread?
Nov 16 '05 #3
Greg <g8*******@msn.com> wrote:
">" is a command shell feature. You could start cmd or command
(depending on OS) with appropriate parameters, but it's probably better
to just start a new thread to write the file yourself from the output.
What would the parameters be for 'cmd' to accomplish this?


Something like

cmd /c net view > c:/test.txt
Alternatively, what would the syntax be for the new thread?


Well, you'd set RedirectStandardOutput to true on the ProcessStartInfo,
then in a new thread, just loop round reading from the
Process.StandardOutput and writing to the file.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #4
Jon Skeet [C# MVP] <sk***@pobox.com> wrote in message news:<MP************************@msnews.microsoft. com>...
Greg <g8*******@msn.com> wrote:
The following dos command creates a text file of all active computers
in the domain:

net view > c:\test.txt

However the following code does not create the text file. Any idea why
this is? The command executes, but it doesn't create the file.

ProcessStartInfo qOptions = new ProcessStartInfo("net",
"view > c:\\test.txt");

qOptions.UseShellExecute = true;
qOptions.WindowStyle = ProcessWindowStyle.Minimized;
DOS = Process.Start(qOptions);
DOS.WaitForExit();


">" is a command shell feature. You could start cmd or command
(depending on OS) with appropriate parameters, but it's probably better
to just start a new thread to write the file yourself from the output.


I actually got it using:

cmd /c net view > c:\test.txt
Nov 16 '05 #5

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

Similar topics

13
by: Droolboy | last post by:
I'm trying to build a fairly small (max. 10 different pages) site using php, and it's becoming obvious that I need some kind of model view separation. Having done a few searches, I've come...
5
by: ScottyBaby | last post by:
Hi, I've run into a curious problem with MS SQL Server 8.0. Using sp_help and SQL Query Analyzer's object browser to view the columns returned by a view, I find that sp_help is reporting stale...
8
by: Jef Driesen | last post by:
I'm implementing some image processing algorithms in C++. I created a class called 'image' (see declaration below), that will take care of the memory allocations and some basic (mathematical)...
1
by: Endif | last post by:
Hello, I am on creating a new Logical file (View) using the ISeries Windows Navigator for DB2/400 V8. It is based on SQL Query. when the physical files in SQL Query are updated, the View fails and...
1
by: Kevin Myers | last post by:
Hello, I'm an experienced application developer in some languages (including various SQL dialects), but have very little experience with MS Access or VBA, and am having trouble figuring out how...
6
by: Paolo Pignatelli | last post by:
I have an aspx code behind page that goes something like this in the HTML view: <asp:HyperLink id=HyperLink1 runat="server" NavigateUrl='<%#"mailto:" &amp;...
10
by: dwok | last post by:
Does anyone know of a good article that discusses creating a "Tree View" control in ASP.NET? Or perhaps a Tree View Control that comes with source code? I have come across a lot of tree controls...
1
by: sainiamit25 | last post by:
Hi, I want to create a materlised view log in my database A and materlised view in some other database B. I was successful in creating materlised view in database B (after creating a dblink with...
2
by: existential.philosophy | last post by:
This is a new problem for me: I have some queries that open very slowly in design view. My benchmark query takes about 20 minutes to open in design view. That same query takes about 20 minutes...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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,...
0
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...

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.