473,750 Members | 2,225 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

bat file doesn't function properly

12 New Member
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.dl l" Alias "ShellExecu teA" (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("w script.shell")
shell.run("c:\s ervtool2\fonts. bat")
shell = Nothing
Oct 2 '07 #1
8 2057
Plater
7,872 Recognized Expert Expert
Why not just use the Process class? It was designed to run programs from withen your program.
Oct 2 '07 #2
Dmenace
12 New Member
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.
Oct 2 '07 #3
Plater
7,872 Recognized Expert Expert
Well you are using nasty dllimports when there is a perfectly good set of controls already built to handle it.
Oct 2 '07 #4
Frinavale
9,735 Recognized Expert Moderator Expert
I've moved this question to the Windows Forum.
Oct 2 '07 #5
Dmenace
12 New Member
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\f onts.bat"


'proc.StartInfo .Arguments = "args_for_f ile"


'proc.Start()


'proc.Kill()
'End Sub
Oct 3 '07 #6
epots9
1,351 Recognized Expert Top Contributor
changed thread title to something for appropriate
Oct 3 '07 #7
Plater
7,872 Recognized Expert Expert
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)
Oct 3 '07 #8
Dmenace
12 New Member
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
Oct 3 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

5
2296
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; include(http://www.anotherserver.com/foldername/phpfiletocall.inc); The .inc file is php formatted. Variables are passed to it (not via GET or POST though) and returned using return(variablenames, etc);
17
2332
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>
52
7529
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 file doesn't exist.Now tell me what should I do! Thanks
89
6061
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 used." Could anybody tell me why gets() function is dangerous?? Thank you very much. Cuthbert
1
6504
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" setting to be "E_ALL", notices are still not getting reported. The perms on my file are 664, with owner root and group root. The php.ini file is located at /usr/local/lib/php/php.ini. Any ideas why the setting does not seem to be having an effect? ...
9
2193
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 with many configurations settings, once the options are set the values will not change much. So I thought it would be a good idea to move the data to a flat file. I have written a small wrapper class to first look for the file, if it exists...
13
3558
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 some javascript code that calls window.open. I pass the resource url of page B to Page A's window.open call. Page B is then loaded and executed but none of the server-side code is rendered. If I view the source of the page, the code (and page...
0
2144
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 rinjael, triple des, but it doesn't seem to encrypt certain files at all. Can you please tell me what the problem is. I don't understand why this function doesn't work when I call it and encrypt the file. when I search for the file it still pulls up...
2
2746
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 javascript that works fine until I try to separate the script into a .js file. I've found that only the script that is called from events set in the aspx.cs file don't work. I eliminated all script except two functions. One is used with the .cs file...
0
8838
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9396
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9339
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9256
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6081
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4713
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4887
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3322
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2804
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.