VS 2008 Batch File Running
Jun 15, 2009I have a batch file on my desktop.how can i run it with vb???
View 1 RepliesI have a batch file on my desktop.how can i run it with vb???
View 1 RepliesI have this problem in VB.NET in c#, I have this project where I need to run a batch file, which is easy enough. But my problem is I need to display everything that shows up on the batch file, in the cmd window, in a textbox, now, this code opens the file no problem:
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.EnableRaisingEvents = false
proc.StartInfo.FileName = "C:\Users\jwoow\Desktop\Server\run.bat";
proc.Start().ToString();
but it doesn't move the code over to the textbox, this code transfers the last displayed line, but not the entire thing of the batch file and it also closes the cmd window, i need it to stay open:
Process p = new Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
[code]....
the batch file is for a server, it displays the amt of users on it (updates ever 2 minutes) and shows different events taken by the users. so it is constantly updating.
Not sure if there is a better way to do this but this isn't working. Just trying to run a batch command "query session" and put it into a text file using "> sessions.txt". When I run this command in a command prompt it works fine and spits the output to the text. I've tried just making the batch file in the same folder and executing that with Process.Start, still empty text file. Tried modifying the loop and no go also
Imports System.IO
Public Class Form1
Dim counter As Integer = 0
[Code]....
I'm having different results when running openfiles.exe manually than when I run it with Process.start() Below is the portion of code making the call. I have read in several places that using the "runas" verb might make a difference since I am running on Win 7 x64, however I am still experiencing different results.
[Code]...
i know how to shell an existing batch file with shell, however, the code inside the batch i want to change depending on a certain variable,so is there a way i can write a textfile and save it as a .bat then run it, and delete it after, so the user does not really ever see the .bat file (so it seemingly looks like the program itself is running the commands)
View 4 RepliesI am having a hard time running .bat files programatically.[code]
View 9 RepliesI need Visual Basic to run a batch file I have placed a batch file inside my startup application directory Inside the batch file I have WUinstall /install /reboot "When I double click the batch file it works perfect" Visual Basic 2008 Command Button I Have
Dim p As Process
Try
'instance a new process
p = New Process
[code]....
When I click this command button all I get is CMD window just flashes. When I hold down the enter key I can faintly read something about it is not an internal command.
my vb net program runs an external batch file for some operations for 2 min,but when it starts to runmain form become unreadable and emptyalthough it has information
my code
RichTextBox1.AppendText( "cmd is running, can take up to 2 min to complete...")
RichTextBox1.Refresh()
[code].....
i have a problem with SetEnviroment function in VB.net. i have a small program created with vb.net and want to communicate with batch file changing the environment variables but as I mentioned in the below sample code is not running clear and while run.bat is running there is no effect inside batch file What might be the problem?
[Code]...
I believe this is an encoding issue due to the resulting output. I am trying to make a batch file (meaning .bat) from VB.NET. The output looks fine in a normal text editor, but when executed via the command prompt, it keeps giving me syntax errors to start. I've even tried using CharCodes, but still to no success.
Module Module1
Sub fileop()
Dim cd As String
Dim fnd As String
Dim del As String
Dim ms As String
[Code] .....
how can i write a batch file into console application
View 3 RepliesI am a newbie to VB. I am try to achieve the following
1) Remote login to a PC
2)Check if a specific program has terminated
3)If it is , the program has to restart the program file located on the desktop.
is there possible to encrypt a command batch (.bat) file so that user can't read the source code?
Or is it possible to embed it in VS 2008 so that user are invisible to the cmd file?
I have a VB program that writes a batch file to allow me to run a line of the following format:java <my class file> [options]I then run the batch file using the Shell() routine in VB.When I do this it says it cannot find <my class file>. However if I run the same batch file from a dos prompt it works.why it works in a dos prompt but not in the Shell function?
View 1 Repliesi am creating an app that when a button is pressed a batch file is executed and hidden from view.I have managed to get the output of the batch file to be displayed in a text box.
View 1 Repliesi need to read a xml file from the command prompt batch file.
View 4 RepliesI have been looking all day trying to find a way to do this. I need to run a Batch file which is held on a server, the file path begins with a IP Address which DOS doesn't like. So i found the pushd command which assigns a temp drive letter from which you can run the Batch File.If i was simply running a normal program or file i would use:
Dim proc As Process
proc = Process.Start("c:\BatchFile.bat")
proc.WaitForExit()
[code].....
I am trying to create a program that renames files to 1 - (however many files are in the folder) and also convert .pngs to .bmps.
If RadioButton1.Checked = True Then
Dim files As String()
files = IO.Directory.GetFiles(TextBox1.Text)
Dim filepath_new As String
filepath_new = TextBox1.Text
For Each filepath As String In files
[Code] .....
how to convert batch file to exe using vb.net [Code] after i read the batch file but how can i save it as exe.
View 6 RepliesI have an old batch file i use that I would like to convert to vb.net,
The Batch file use a .reg entry to set the cleanmgr options. abnd then calls the sagerun command to run those options
I pretty sure I know how to create the registry entries what I am not sure to do is how to call the cleanmgr with the switches /dc /sagerun:200 then display a box saying it is complete and deleting the prefetch folder of anything older then 'n' days . [code]...
I have a batch file that loads into a form containing 20 IT related incidents. I have managed to upload the batch file into a form. However I have an algorithm that reads an incident and manages to classify into its topic: See Below the data imported form the file:
1) Need to install jet direct to printers and connect users
2) Remove ms project software from PC 04384 and re install on 07882
3) install needed for 2 vectra software for Finance department PC assest 9875 and 8711
4) Supply PC 500 SITA Rest Area phone 2268 Asset and S/N
5) Add printer Epson label printer in ISD2
6) Remove Jetdirect and network printer via port PPSS PC add printer
7) Credentials for user UK15428 not logging onto the network
8) Install CD RW and unsupported software for UKX3395
9) Need Entire software installing on asset 5530, and access to password for use.
10) phone handset not functioning for UK10529, new phone required.
11) install card reader and software following PC move
12) New user group UKG0345 no mail just printers on PC00856 and PC02427
13) Update outlook remove project from PC D0186 in Prod Control per Tony Campbell install on Alisons PC in NDS
14) Unable to log onto the network, profile will need recreating
15) Remove spent toner cartridge
16) The printer doesnt appear to be printing, it looks like there could be a paper jam of some sort
17) Set up laptop and use local admin password to gain access to backup files
18) Remove image grabber card from PC and install on PC in paint shop have explained to user they will have to contact optivision
19) Cannot get onto network as I have forgotten my password, can you reset for UK15617
20) User cannot access voicemails, need mac address to edit on TOIP software
For example number 1) would be classified as a printer problem. I want the algorithm to be able to read each number, not the whole lot and classify the whole block of text, I want it to classify each incident individually, so there are 20 incidents to be classified.
How can I run a batch from from within vb.net?
View 4 Repliesif I press a button then it send keys to a opened batch file ...
I open batch file with this
Dim proces As String = folder.Text + "process.bat"
Process.Start(proces)
I want to send "stop" to process.bat. How I can do this ?
Or:
How I can close the process.bat when it is running ? I try with:
Public Sub KillProcess(ByVal processName As String)
On Error GoTo ErrHandler
Dim oWMI
[Code]....
I have written a simple folder backup program which, if started with a /s switch (argument), will run "silently" and perform an unattended backup. The obvious way to start the program with the /s switch is from a batch file, which then runs as a Windows Scheduled Task. I would like to create the batch file from the program itself, when it first runs, as it can then write the value of "Application.ExecutablePath" into the batch file follwed by the /s switch.
So, the question is, where best to save the batch file without running into Vista/Windows 7 permission problems? Is the local application data folder suitable?
Bear in mind there are three parts to this: my vb.net app needs first to create a batch file somewhere without permission issues, that batch file needs to be accessible to Windows Task Scheduler and then, when the batch file is run, it needs to start an .exe which is most likely in the "program files" folder.
How can I include a batch file or an .exe file in my setup, that runs after setup is complete?
View 2 RepliesI am writing a simple program that I'm going to use to end a process and then delete a folder with its contents but, I am running into some errors when I try to delete an .dll file using Kill. I would have figured this out on my own but its being weird.
1. If I run the .exe it doesn't delete it and gives me and error
2. I i run the .exe as administrator it doesn't delete it and gives me an error
3. If I run visual basic 2008 as Administrator and then execute the program it works.
4. If I try and execute it again as Administrator under Visual Basic it doesn't work and says I don't have sufficient access.
What I am trying to do is End a Process so that I am able to delete the folder, the folder contains and .dll which is being stuborn and saying I don't have sufficient access to do this.
Kill
Public Class Form1
Public Sub killprocess(ByRef strproccesstokill As String)
Dim proc() As Process = Process.GetProcesses
[CODE]...
It am trying to launch this code that would normally run from a batch file
Batch file code:
@ECHO OFF
SET BINDIR=%~dp0
CD /D "%BINDIR%"
"%ProgramFiles%Javajre6injava.exe" -Xincgc -Xmx1G -jar craftbukkit-0.0.1-SNAPSHOT.jar
PAUSE
[code]....
When I run the code cmd.exe opens but then nothing happens?
i am creating an app that when a button is pressed a batch file is executed and hidden from view.I have managed to get the output of the batch file to be displayed in a text box.
View 6 RepliesIm running VB.Net 2005.Inside of the program I use the line ystem.Diagnostics.Process.Start("program_) to open multiple programs. For all but one of them this works perfectly. This erros when I try to run a batch file using. System.Diagnostics.Process.Start("C:xx.bat") the batch file opens but then throughs a number of unreconizable java errors follow.
[Code]...
VB.net VS 2008
I need to develop a small application which can do a batch find and replace on all xml files within a folder. Example:
<cardHolderName>
<firstName>Geraldine</firstName>
<middleName>
[Code].....
I want to replace ALL <firstName) tags to John and all <lastName> tags to Smith to protect sensitive date. In addition, there will be other tags such as address, ss number and phoneNumber.
NOTE: There may be multiple instances of <firstName> within the file. 1000 xml files with all replacing names, address etc. with the same fixed name such as John Smith These will be used for testing and to prevent sensitive data from being leaked
There is no doubt that I can do this the long and dirty way. (I am working on).