|
-
Oct 16th, 2006, 05:31 PM
#1
Thread Starter
Junior Member
[RESOLVED] [02/03] creating a batch file
i want to create a batch file and then using it i want to execute a few commands...........
when we type commands in notepad and save it as .bat how can be pass vaiables from the vb.net program to teh bat file..
or can we create a batch file from the program itself....
-
Oct 16th, 2006, 05:36 PM
#2
Re: [02/03] creating a batch file
 Originally Posted by suba_shania
i want to create a batch file and then using it i want to execute a few commands...........
when we type commands in notepad and save it as .bat how can be pass vaiables from the vb.net program to teh bat file..
or can we create a batch file from the program itself.... 
Hi,
Here's a link how to create a Batch File;
http://msdn2.microsoft.com/zh-cn/library/ms181076.aspx
Hope it helps,
sparrow1
-
Oct 16th, 2006, 05:53 PM
#3
Re: [02/03] creating a batch file
Here is one way.
VB Code:
Dim sr As New StreamWriter("C:\Test.bat")
sr.WriteLine("@echo ""Hello World""")
sr.WriteLine("pause")
sr.Close()
System.Diagnostics.Process.Start("C:\Test.bat")
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Oct 16th, 2006, 05:55 PM
#4
Re: [02/03] creating a batch file
A batch file is just a text file that contains commandline instructions. You can create a text file easily enough in VB.NET. If you want to execute a batch file, either pre-existing or one you've just created yourself, then you do so the same way as you execute any other file:
VB Code:
Process.Start("file path here")
If you want to pass commandline arguments to that batch file, again, you do so the same way as you would for any other file being executed:
VB Code:
Process.Start("file path here", "commandline arguments here")
-
Oct 17th, 2006, 11:14 AM
#5
Thread Starter
Junior Member
Re: [02/03] creating a batch file
thx ppl using steamwriter i created a batch file
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|