Latest developer linksBookmark and Share
 
HomeThis WeekTop MonthTop AlltimeSearchRegisterFAQ
  
 
Submit Your Link
Please login to submit your Link
 

Need help either initiating console commands or running an embedded batch file (I'm a bit of a C# ne

Posted: Feb/15/2010   By: pankaj   Points:15   Category: .NET  - .NET Framework    Views:154   Vote Up (0)   Vote Down (0)    

I'm trying to make a program that runs several command prompt console commands after clicking a button
(in this case, "sc \\testserver01 stop spooler" and the like. Failing that, I have several batch files
written up but I do not want them in any way to be physically on the server without them being encoded
into the executable if possible. Is there a way to either run the command prompt commands or an embedded
batch file? I have included some code that runs the batch file fine if I place it locally with the executable,
I can change the path as well and even have it download from other servers or URLS... but that's not what I need.

Any advice?


private void button1_Click(object sender, EventArgs e)
{
//Restarts Print Spooler on Testserver01
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.EnableRaisingEvents = false;
proc.StartInfo.FileName = "t1.bat";
proc.Start();
}

View Complete Post


Comments:
Be the first to comment this post.
 
Post Comment
Please login to post your comment
More Related Resources

Toolbox: Easy File Backup, Exploring Files And Folders Inside Visual Studio, Multiple Monitor Softwa

  
If the responsibility for creating, managing, and executing routine backups is yours, these tools will make it easier. Also see how you can browse folders and files from inside Visual Studio.Scott MitchellMSDN Magazine May 2009

ASP.NET Workflow: Web Apps That Support Long-Running Operations

  
Integrating workflow into ASP.NET applications means communicating with activities via a workflow queue and hosting the runtime in the global application class. We'll show you how.Michael KennedyMSDN Magazine January 2009

Access Control: Understanding Windows File And Registry Permissions

  
Understanding the ACLs that govern permissions and rights before an operation is allowed to proceed is critical to enhancing security.John R. MichenerMSDN Magazine November 2008

Advanced WPF: Understanding Routed Events And Commands In WPF

  
See how routed events and routed commands in Windows Presentation Foundation form the basis for communication between the parts of your UI.Brian NoyesMSDN Magazine September 2008

Cmdlets: Extend Windows PowerShell With Custom Commands

  
Jim Truher presents an introduction to writing and registering your own custom cmdlets to be used in Windows PowerShell.Jim TruherMSDN Magazine December 2007

Parallel LINQ: Running Queries On Multi-Core Processors

  
Use Parallel Language Integrated Query (PLINQ) to take advantage of multi-processor computers and the newer wave of multi-core processors.Joe Duffy and Ed EsseyMSDN Magazine October 2007

Test Run: Test automation with Windows XP Embedded

  
This month's column explores how to create lightweight but powerful UI test automation for software systems that run on Windows XP Embedded.Dr. James McCaffrey and Mike HallMSDN Magazine October 2007

NTFS: Enhance Your Apps With File System Transactions

  
Presented here is an overview of Transactional NTFS and how it revolutionizes transactions.Jason OlsonMSDN Magazine July 2007

.NET Matters: Handling Messages in Console Apps

  
Many developers who use the Microsoft .NET Framework think that application type is tied to the libraries that can be used in that application. Stephen Toub clarifies.Stephen ToubMSDN Magazine June 2007

Mobilize: Explore The New Features In Windows Embedded CE 6.0

  
Paul Yao presents an overview of Windows Embedded CE 6.0.Paul YaoMSDN Magazine December 2006
 
Categories:
.NET
Java
PHP
C/C++/VC++
HTML/XML
SAP
MainFrames
Data Warehousing
Testing
MySQL
SQL Server
Oracle
Javascript/VB Script
Others
Login
 
 
 
 
 Forgot password
 Contact Us   Terms Of use   Share your knowledge