Specialty Forums
Security and Virus
General Hardware
CPUs/Overclocking
Networking
Digital Photo/Video
Office Software
PC Gaming
Console Gaming
Programming
Database
Web Development
Digital Home

General Forums
Windows XP
Windows Vista
Windows 95/98
Windows Me
Windows NT
Windows 2000
Win Server 2008
Win Server 2003
Windows 3.1
Linux
PDAs
BeOS
Novell Netware
OpenVMS
Solaris
Disk Op. System
Unix
Mac
OS/2

Drivers
Driver Scan
Driver Forum

Software
Automatic Updates

BIOS Updates

My Computing.Net

Solution Center

Free IT eBook

Howtos

Site Search

Message Find

RSS Feeds

Install Guides

Data Recovery

About

Home
Reply to Message Icon Go to Main Page Icon

Subject: Batch Script Help

Original Message
Name: pedrorod
Date: May 1, 2008 at 11:05:31 Pacific
Subject: Batch Script Help
OS: Windows XP
CPU/Ram: 3ghz
Model/Manufacturer: Dell
Comment:
I am new to batch scripting and need some help. Here is what I wish to do.

Users will download a folder and run a batch script that will call some executables which reference some files. The problem I have is that different users will download the folder to different locations. Hhow do I go about making the batch script run the executables from the current folder no matter where the folder has been saved by the users?



Report Offensive Message For Removal

Response Number 1
Name: klint
Date: May 1, 2008 at 13:57:45 Pacific
Subject: Batch Script Help
Reply: (edit)
You shouldn't have to do anything special. It should just work, as long as the batch script does not make any assumptions about the absolute location of the folder. I.e. don't run a file as C:\Programs\prog.exe, just run prog.exe and it will be taken from the current folder.

Report Offensive Follow Up For Removal

Response Number 2
Name: Mechanix2Go
Date: May 1, 2008 at 15:25:42 Pacific
Subject: Batch Script Help
Reply: (edit)
Hi klint,

That only works if the folder is in the path. Unlikely if users are saving here, there and everywhere.

If b 'download' you mean COPY, maybe something like this:

::==
@echo off
setLocal EnableDelayedExpansion

set /p dest=choose destination
echo xcopy x:\the\stuff !dest!\/s
echo !dest!\prog.exe


=====================================
If at first you don't succeed, you're about average.

M2


Report Offensive Follow Up For Removal

Response Number 3
Name: pedrorod
Date: May 1, 2008 at 20:34:33 Pacific
Subject: Batch Script Help
Reply: (edit)
Users will download a zip file of a folder containing a few executables and files. There are 3 things that need to run:

winhttpcertcfg.exe -i certificate.pfx -c LOCAL_MACHINE\MY -a %computername%

certmgr.exe -add -c certificate.cer -s -r LocalMwinhttachine Root

dialup.exe /s

Where would I add the above suggestion to the script?


Report Offensive Follow Up For Removal

Response Number 4
Name: Mechanix2Go
Date: May 1, 2008 at 21:17:42 Pacific
Subject: Batch Script Help
Reply: (edit)
@echo off
setLocal EnableDelayedExpansion

set /p dest=choose destination
pushd !dest!\
xcopy x:\the\stuff
pkunzip *

winhttpcertcfg.exe -i certificate.pfx -c LOCAL_MACHINE\MY -a %computername%

certmgr.exe -add -c certificate.cer -s -r LocalMwinhttachine Root

dialup.exe /s


=====================================
If at first you don't succeed, you're about average.

M2


Report Offensive Follow Up For Removal

Response Number 5
Name: klint
Date: May 2, 2008 at 02:28:44 Pacific
Subject: Batch Script Help
Reply: (edit)
pedrorod, M2 is providing good help so I won't confuse you by adding any more info, but I'd just like to clarify something mainly for M2's benefit:

When you run a program by typing its name without a path, it doesn't just look for it in the PATH. It first looks in the current directory, and only looks in the PATH if it doesn't find it in the current directory. Note that this differs from how it's done on Unix.


Report Offensive Follow Up For Removal



Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Batch Script Help

Comments:

 
  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 


Data Recovery Software



Version Tracker Pro
Keep your software current and secure, effortlessly

Click Here for a Free Scan

Driver Agent
Automatically find the latest drivers for your computer.
Click Here for a Free Scan



The information on Computing.Net is the opinions of its users. Such opinions may not be accurate and they are to be used at your own risk. Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE

All content ©1996-2007 Computing.Net, LLC