|
Load path to bat file and then open this file as a new process.
Dim Location as New Process
Dim myProcess as new Process;
myProcess.Start(Path & ".BAT")
|
|
|
|
|
There are two ways to do this (that I know of):
1. Open the batch file, read through it, edit the text as needed (most elegant solution)
2. Create a new batch file each time and run it (most practical solution)
Finally use Abhinav's trick to launch the bat file.
My advice is free, and you may get what you paid for.
|
|
|
|
|
try this one first:
Process.Start("batchFile.bat", "all the parameters");
and if that does not work, try:
Process.Start("cmd.exe", "/C batchFile.bat all the parameters");
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Thanks a lot for the all answers,
I wrote below codes in my application:
<br />
<code> Dim BatchFile as string ="C:\RunScript.bat"
Dim StrView As String = "C:\Myview.sql"
Dim psi As System.Diagnostics.ProcessStartInfo = New System.Diagnostics.ProcessStartInfo(BatchFile, String.Format("-S {0} -d {1} -U {2} -P {3} -i {4}", txtMachineName.Text, txtSourceDB.Text, txtUserName.Text,txtPassword.Text, StrView ))
Dim proc As System.Diagnostics.Process = New System.Diagnostics.Process()
proc.StartInfo = psi
proc.Start()
When I run the application, all the above codes are executed but when I check the result, it seems that the batch file does not run.
Is there any problem in my code?
Could you please give me an example.
To Luc:
Thanks for reply, but I do not understand exactly what does below code mean?
Process.Start("cmd.exe", "/C batchFile.bat all the parameters");
Could you please give me an example.
Many thanks,
Orchid
|
|
|
|
|
Hi,
you don't need CMD.EXE, my first suggestion works just fine.
you can check whether a batch file runs by including some command that leaves a trail, such as:
- copying a file
- opening some other program (e.g. Notepad)
Here is a C# example that creates 2 files (a text file and a batch file) and runs the batch file:
string batchFile="test.bat";
string textFile="test.txt";
File.WriteAllText(textFile, "Demo text file"+Environment.NewLine+"with dummy text");
File.WriteAllText(batchFile, "Notepad %1");
Process p=new Process();
p.StartInfo=new ProcessStartInfo(batchFile, textFile);
p.StartInfo.CreateNoWindow=true;
p.StartInfo.UseShellExecute=false;
p.Start();
I suggest you translate it to VB and run it!
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Why use the batch file at all?
Why not just use Process.Start to launch SQLCMD directly? Admitedly you will probably have to use the cmd process to launch it, but the batch file is an extra set for no gain.
|
|
|
|
|
Hi, all,
I am using visual basic 6.0. When I run a program created years ago, I got the following error message:
Line 16: Cannot load control SSToolbar; license not found.
SSToolbar is a third party tool.
I don't I really need license for SSToolbar tool or there is some problem in VB.
I search internet, should run VB6Cli.exe to fix license issue for VB5.0, but I am using VB6.0, what should I do?
Thanks!
|
|
|
|
|
without knowing anything about SSToolbar you may not need a license for SSToolbar, but SSToolbar may need a license for something else...like a particular version of Windows or a particular version of Office.
Hopefully someone on here actually knows the product.
|
|
|
|
|
|
Thanks all.
I also see this link, but I am confused.
I am using VB 6.0, do I need to run VB6Cli.exe? Somebody said VB6Cli.exe is shipped with VB6.0, is it right?
|
|
|
|
|
|
Dave,
So you think I should run that exe file?
|
|
|
|
|
Well, unless you find another solution, you have nothing to loose!
Although, it is your choice, and i am not taking any responsibility!
The file is direct from microsofts website, so not as if it is being downloaded from some random website.
The other option is to reinstall vb6 (probably an in place over install).
|
|
|
|
|
Dave,
Thank you very much.
|
|
|
|
|
Hi, Dave,
I run that exe file, but when I run the program again, I still get the same error.
License information for this component not found. You do not have an appropriate license to use this functionality in the design environment.
What else should I do?
Thanks!
|
|
|
|
|
I can't remember if SSToolbar was a control that shipped with VB6 or not? i don't keep VB6 installed anywhere now, so can't go and check.
Can you go to the DLL in explorer and look at the file info and see who the company is that wrote it. Then it might be just a case of some more google searches until a solution found. Might need to get hands on the original DLL installer, to get the license file.
|
|
|
|
|
I don't think SSToolbar shipped with VB6. AFAIR it was a free 3rd party control. Similarly to the OP, I don't think SSToolbar requires a license.
I would try to remove it from the form, add it again and recompile.
It could, however, be that the control needs to be properly installed in VB6, and from what I gather, you don't have the installation file, only the distributed ocx, right?
modified on Tuesday, May 11, 2010 7:14 AM
|
|
|
|
|
Hi, Thanks for reply.
SSToolBar is not shippped with VB6, it's a third party too.
After I unregister it and then re-register it again, the above error message gone, but still in the same line, I got the following error:
Run-time error '429':
License information for this component not found. You do not have an appropriate license to use this functionality in the design environment.
I thought it may not really the license issue, should be something in VB part.
How's your thinking.
Thanks!
|
|
|
|
|
It definitely sounds to me like the control should be properly installed in VB6 using the installer for the component, but as I said earlier: I guess you haven't got access to that?
|
|
|
|
|
John,
This project was created years ago by other people. I also install it in my computer, everything is fine. But when I got the source codes and try to run it from VB6, I got this error.
|
|
|
|
|
Have you tried this:
http://support.microsoft.com/kb/194751/en-us[^]
???
[EDIT: OK, sorry - I see from previous posts that you have... - sorry for mentioning it again...]
I don't think it's going to fix the problem, but it's worth a shot...
I seem to recall that there should be another tool/fix that does something similar to some other components, but I haven't located it yet...
And for those moderately interested in what controls are included in VB6, I found this link:
http://support.microsoft.com/kb/194784/EN-US/[^]
modified on Tuesday, May 11, 2010 10:29 AM
|
|
|
|
|
Yes, I already run VB6Cli.exe as Dave recommend. but still same. Maybe I need to reinstall VB6.
I saw somebody has the exactly same issue as me, he solve it. he also run VB6Cli.exe, his comments as following:
When I tried to run the program I received the same message.
I re-downloaded the file and installed it over the top of the other and all works well now.
Thank you so much for the help. Have a good Thanksgiving.
Do you think what the "installed it over the top of the other" means.
Thanks!
|
|
|
|
|
|
That's right, now I remember - SS stands for Sheridan Software Systems. In Nov 2000 they merged with ProtoView Development Corporation and became the notorious Infragistics.
I'll look into it a little more.
As for "installing on top of..." means installing an already installed product without uninstalling the previous version first...
modified on Tuesday, May 11, 2010 10:54 AM
|
|
|
|
|
Thanks. Waiting for your reply.
Anyway, I decide reinstall VB6.
|
|
|
|