Tech Support Guy banner
Status
Not open for further replies.

Batch Files

4K views 27 replies 6 participants last post by  eddie5659 
#1 ·
Hiya

How do you actually create them? I assume these can be used to start a series of programs when activiated.

We use NT at work, but soon moving to 2000, when they can upgrade all the PC's on site.

Anyway, when I log on, I usually open Outlook, BPCS (internal database), QSIS (global database), and a Web page.

How would I go about creating a batch file? The IT dept let you do most things, but if you can't, its because they disable it.

For instance, someone changed the file extensions, and it let them. Never did find the culprit :mad:

Thanks in advance

eddie
 
#3 ·
for example,I have a batch file in my Startup folder for Win98SE which contains the following:

@echo off
net use y: \\randy-350\c
net use z: \\randy-350\d
DELTREE /Y C:\WINDOWS\TEMP\*.* > NUL
rem C:\Windows\DrWatson.exe
exit


This reestablishes my networked drives, deletes my Temp folder,and used to run Dr Watson before I REMmed it out, then closes the dos window.

Batch files are cool and easy to automate tasks that happen often.
 
#4 ·
Thanks guys

Right, say for instance all I'm wanting to do is open a few programs, so that I can wander away, and grab a cuppa (they're slooow pc's)

Randy, you said that you ran Dr Watson, so you just put C:\Windows\DrWatson.exe

I assume I track down the actual locations, on the C drive, as others relate to Public, Private, etc.

Do I need that '@echo off' bit in?

I'll have a look at the locations tomorrow at work.

Thanks

eddie
 
#5 ·
No, the echo off bit just means you don't see the commands as they are executing, and the close means the window closes on exit.


doing a batch file is as easy as that, just find the full location of the executable and put it in there.
 
#9 ·
Thanks pvc, haven't looked at it fully, as I'm ahem, working :p

Okay, I can get Outlook to open:

@echo off
start C:\Program Files\Microsoft Office\Office\OUTLOOK.EXE

But QSIS is pretty hard. Does DOS recognise underscore _ ?

The location is:

C:\Program Files\QSIS_NG\QSISNG.EXE

Blast, can't get Outlook to open now. Gonna try over the week, so I'll let you know. Each program has about 10 locations :(

eddie
 
#10 ·
Eddie,

In Win98 you can use Quotation marks around the full path to a file and the path is read. I am not sure you can do that in NT4.


Otherwise, use the short file names. The spaces in the name ends the path if your system cannot read long file names. And there is a limit to the number of characters you can use. A quick way to get the path is to open a command prompt. Open the Folder which has the file you want to open. Go to start>Run and type command (or cmd) I am not sure for NT. The full path to that folder will show in the Dos Box.

When creating the Batch, type the path to the exe. I don't think you need Start. If you wanted to open a text file, you would need Start. But not for an exe.




@echo off is a command which prevents the Dos box from showing the commands as they are executed.

C:\Program Files\QSIS_NG\QSISNG.EXE should not be a problem if you use the correct name format to open it.




Also, create a shortcut to the program and have it run minimized and close on exit. To do that right click on the batch and choose properties. Click the Program Tab. Choose Run Minimized and check the Close on exit box. This will create a shortcut icon in the same folder as the batch. You can then move the shortcut to a convenient location. You can change the icon too if you like.

See if this helps.

Mo
 
#11 ·
Thanks Mo, I'll try it in the morning.

I'll do it throughout the day, but as I say, there are about 10 different locations for each one I want, so may be a case of replying in a week :)

I'll keep you all informed.

Thanks

eddie
 
#12 ·
Mosaic1, in w2k I'm unable to get a batch file of this type to work without the "start" at the beginning.

eddie5659, with C:\Program Files\QSIS_NG\QSISNG.EXE, you might try changing the name of the folder QSIS_NG to QSISNG. That's what I had to do with Popup Killer. I had to get rid of the space for it to work. I did it with the folder and the exe file.
 
#14 ·
You don't need START proceeding the program name in the batch file for any version of windows. START is used to invoke a separate instance of the command processor, so if you have a batch file:

START dir
START dir
START dir

You'll end up with three command prompt windows open, all with a directory listing in them. This is probably not what most folks want to do. :)

START is useful if you have several long running processes that you want to run concurrently.

For more information about START, try typing:

START /?

... at a command prompt.
 
#15 ·
There must be a difference between cmd.exe and command.com

I just ran a simple batch file in XP. I found I did need to use Start in front of each item or the first item ran, but the second didn't until I closed the first. Without the start in front of the item, the next command does not execute until the first has finished. That means I had to close the program I opened before the next line would execute. If you want to open more than one program at a time, use start in NT.


In 98, if I try to run a text file without using Start, I get a bad command error. What I said originally does apply to Win98SE using Command.com. I can list several programs not using start and they all open not waiting for the prior to close. Not so in XP.

I see this is just one more difference between NT and Win9x.
The rule of thumb should be test it and see how it goes on your OS.
 
#17 ·
You can't argue with results. If your way works for you, that's all that really matters. :) Being an old DOS re-tread, I still use batch jobs for a host of tasks, and other than a couple of specific instances where I wanted multiple command prompts running simultaneously, I've never used START.

For the record, CMD.EXE is the NT command shell. OMMAND.COM, as shipped with Windows NT/2K/XP, is merely a "pass through" for 16-bit apps. Interactive features of CMD.EXE and COMMAND.COM differ, but all command lines are actually executed by CMD.EXE.
 
#18 ·
Hiya

Still having problems creating this. I open a DOS command window, locate the Dir in which the program is in, and typed it out exactly as its shown, including capitals if needed.

It keeps coming up with, say, C:\Programs cannot be found.

I think this may be a dead issue, but I'll keep trying, and let you know :)

eddie
 
#19 ·
Eddie,

Use short file names. The space in the name is cutting off the path. It thinks you are looking to a directory named C:\program
Not C:\program Files


DOS is not case sensitive. C:\Progra~1

OR try "C:\Program Files\Eddie\my file.txt"

If the Quotations don't work, you'll have to use Short FIle names.
 
#20 ·
Actually, if you put the names in quotes, a command window will handle long file names. i.e.

"C:\Program Files\Internet Explorer\iexplore.exe"

will indeed launch IE from a command prompt.
 
#22 ·
Okay

This is what I created:

@echo off
"C:\Program Files\QSIS_NG\QSISNG.exe"
"C:\Program Files\Rally\SESSIONS\MACCLESFIELD WHITE.edp"
"C:\Program Files\Microsoft Office\Office\Outlook.exe"
"C:\Program Files\Internet Explorer\Iexplore.exe"
exit

Now, what happens, is that it opens QSIS first, to the login screen. But, it won't open the rest until you close it. If you close it, Macclesfield starts up, but again, thats it.

Any ideas?

Thanks

eddie
 
#24 ·
Hiya

That hasn't worked either. I'll try it on another PC at work, as we're changing to Dell pc's running Win2000. But, as its a big site, this will take time. I'll track one down thats been changed, and let you know.

Thanks

eddie
 
#25 ·
Okay

Kinda got an update.

It seems that creating Batch files has been denied. I went to NotePad, and renamed it to test.bat
It remained a notepad icon. I'm thinking that as CIBA (the company I work for) is based in Switzerland, they want everyone's pc the same.

Unless I can change that extension, its a mute subject. However, it is a faster pc and I've dragged some icons to the taskbar, for quick opening.

eddie
 
Status
Not open for further replies.
You have insufficient privileges to reply here.
Top