Forum Home
Press F1
 
Thread ID: 111623 2010-08-04 08:16:00 Batch Install (2) The Error Guy (14052) Press F1
Post ID Timestamp Content User
1124654 2010-08-04 08:16:00 Ok, I'm working on another version of a .bat installer to make the installation of modified system files and fonts automated and easier.

I need to set the current directory so that users can run the .bat from the files location on any drive.

I saw one forum that suggested using Echo %CD% set CURRENTDIR=%CD%

However, in my usual working style I can't get it to work ( done something wrong) so heres the code so far

Echo %CD%
Set CURRENTDIR=%CD%
xcopy Fonts\ C:\users\mac\desktop
quit


I get an error saying invalid path (I think this is referring to Fonts) so i dont think that the current dir is being set properly.
The Error Guy (14052)
1124655 2010-08-04 08:59:00 Out of curiosity - why are you using a batch file for this rather than a real installer?

Something like Inno Setup (www.jrsoftware.org) or NSIS (nsis.sourceforge.net) would be ideal. Inno Setup has a very good GUI available (ISTool) if you'd prefer not to write the scripts yourself.
Erayd (23)
1124656 2010-08-04 09:21:00 I need to re-name and take ownership of windows files. it also requires running VB scripts in some cases. this is more of a native function in CMD rather than installers. ill give inno a look though, I have used NSIS before though and its good for installing the contents of zips The Error Guy (14052)
1124657 2010-08-04 09:35:00 Inno should be able to manage that - not sure if it has the capability natively (it might, but I've never needed it), but if not then it should certainly be able to do it via hooks. Erayd (23)
1124658 2010-08-04 10:07:00 If your bat file is on the path, when they run it, it will run in their current directory. Or do you need to know what the directory is? dolby digital (5073)
1124659 2010-08-04 10:11:00 I need the bat to find its current dir is and set it so it can copy from there to the target folder The Error Guy (14052)
1124660 2010-08-04 10:12:00 I think the problem is that the OP wants to run the batch file from the CD but of course that drive could be anything from D:/ upward. Snorkbox (15764)
1124661 2010-08-04 10:36:00 not so much a CD but from what ever directory the user runs the bat from, if the d/l then run it it would be from the temp dir or an extracted location such as the desktop The Error Guy (14052)
1124662 2010-08-04 10:49:00 So is this going to start out as a self extracting zip file or what? If so then maybe you could specify where it gets extracted to. Snorkbox (15764)
1124663 2010-08-04 11:12:00 How about


pushd <install_dir>
...
(run stuff)
...
popd

That will set the directory to the installer folder & then restore to where you were when you started.
MushHead (10626)
1 2