Okay, I need help with getting a simple bat file to execute. For whatever reason it seems to work but however it's not actually copying files that I need it to. I have ran the bat file by itself and it works just fine. The purpose of the bat file is to get it to copy font files (*.ttf) to the windows\fonts folder because I use unusual fonts on a form in VB 2.0. So in order for people to see it correctly they'll need the fonts installed.
Can someone help me with this please here's the code that I use. I'm also open to a different way of doing this, so ideas I'll take em.
Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Integer, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Integer) As Integer
Dim shell
shell = CreateObject("wscript.shell")
shell.run("c:\servtool2\fonts.bat")
shell = Nothing
8 2046
Why not just use the Process class? It was designed to run programs from withen your program.
Why not just use the Process class? It was designed to run programs from withen your program.
Well, I suppose I could do that I just figured that there was something small that I've missed. So I was going to try to just fix what I've done. Instead of a rewriting it. But, never mind.... I guess. Thanks for the help.
Well you are using nasty dllimports when there is a perfectly good set of controls already built to handle it.
I've moved this question to the Windows Forum.
Ok maybe I'm not understanding the process class to the fullest I should. So maybe I could use a little help in this area. I've tried a couple of processes to see if I could it to work. Mind you I'm doing this in VB .net 2.0 just so that's clear.
I've tried putting this on a Button_Click, and I've tried putting this in a form load. My result is not in error so I'm confused why it's not working.
Because it'll show the cmd prompt quickly as if it ran the bat file however it hasn't because the 2 ttf files were not copied to the Windows/Fonts folders. Also worth a note is that if I run the bat file directly it works every time...... so either I've done something wrong here in code, or I'm also curious if there is a way to directly call the same copy commands that I'm doing in the bat file within the code it's self. Code is down below.... Thanks a head of time.
Here's some code that I've tried:
'Dim proc As New Process()
'proc.StartInfo.FileName = "c:\servtool2\fonts.bat"
'proc.StartInfo.Arguments = "args_for_file"
'proc.Start()
'proc.Kill()
'End Sub
changed thread title to something for appropriate
For ease of use, at the end of your .bat file add "pause"
This will make the window stay open until you press a key. Then you can see what the error message inside the cmd window is
(most likely "cannot find file to copy" or something along those lines)
For ease of use, at the end of your .bat file add "pause"
This will make the window stay open until you press a key. Then you can see what the error message inside the cmd window is
(most likely "cannot find file to copy" or something along those lines)
You were exactly correct. I just tried that, and I apparently being the intellect that I am..... didn't pay attention to the directory path in which it was copying from. Now it works.
Thank you for the help.
D
Sign in to post your reply or Sign up for a free account.
Similar topics
by: hntgzr |
last post by:
I am trying to include a function in a .php file on a different server from
the main .php files.
I am using:
include_path=http://www.anotherserver.com/foldername;...
|
by: Joe Laughlin |
last post by:
I've not used C much before, so I don't know how robust or good this code
is. I'd appreciate any feedback or criticisms anyone has!
Thanks,
Joe
#include <stdio.h>
#include <string.h>
|
by: paytam |
last post by:
Hi all
Can anyone tell me how can I check that a file exist or no.I mean when
you use this commands
FILE *fp;
if(!fp)
//Could not open the file
doen't show why it can not open it,may be the...
|
by: Cuthbert |
last post by:
After compiling the source code with gcc v.4.1.1, I got a warning
message:
"/tmp/ccixzSIL.o: In function 'main';ex.c: (.text+0x9a): warning: the
'gets' function is dangerous and should not be...
|
by: laredotornado |
last post by:
Hi,
I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed
using Apache's apxs and the php library was installed to
/usr/local/php. However, when I set my "error_reporting"...
|
by: FFMG |
last post by:
In my site I have a config table, (MySQL), with about 30 entries; the
data is loaded on every single page load. This is not the only call to
the db, (we do a total of about 8 calls to the db).
As...
|
by: Bob Jones |
last post by:
Here is my situation:
I have an aspx file stored in a resource file. All of the C# code is
written inline via <script runat="server"tags. Let's call this page
B. I also have page A that contains...
|
by: lildiapaz |
last post by:
Hi, everyone
I'm developing a c# windows application that allows the user to encrypt any file type. i would like to encrypt the file using a powerful encrypting algorithm. I've tried to use the...
|
by: Matthew Wells |
last post by:
Hello. I'm reposting this because my prioe post's subject line was
incorrect.
I'm developing an asp.net 2.0 project using VS 2005 on XP sp2 with all
the updates. I have an aspx page with...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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,...
|
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
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,...
| |