maniaq Posted May 6, 2006 Share Posted May 6, 2006 (edited) hi, i don't know if i'm writing in right section, but i need help.first of all i know how create a program that copies all needed files to some place i want (with installshield) but then i face up some problems:first of all i have a .bat file that should be launched when i install the program and inside that file a have many lines with this line "I386 source"which i want change during my program installation, something like this:i want to locate windows source I386 folder and i want that "I386 source" would be changed to it, for egzamplefrom this "I386 source"to thisE:\Atomix\XP\XP\I386insise that .bat file (maybe there is an easier way).how could i do that? Edited May 6, 2006 by maniaq Link to comment Share on other sites More sharing options...
nitroshift Posted May 7, 2006 Share Posted May 7, 2006 i didn't quite get you but maybe editing the .bat file will help... Link to comment Share on other sites More sharing options...
ophiel Posted May 7, 2006 Share Posted May 7, 2006 (edited) copy and paste these lines into a file called source.bat:@ECHO off IF NOT [%1]==[] goto start ECHO. ECHO no command line argument passed. ECHO. GOTO :eof:startECHO argument passed = %1after that if for instance you ran source.bat d:\i386 the %1 variable would equal d:\i386, try the example for yourself.you can also set your own variables within the .bat code using set.for instance:set test=this is a testlater in your code %test% would equal this is a test Edited May 8, 2006 by ophiel Link to comment Share on other sites More sharing options...
druiddk Posted May 10, 2006 Share Posted May 10, 2006 @ophiel > even though that will work im still curious if someone has a good tip for replacing lines inside a bat or txt file for that matter Link to comment Share on other sites More sharing options...
ophiel Posted May 10, 2006 Share Posted May 10, 2006 i don't understand why you would want to replace a line in a batch script. it would require patching the file and kind of negates the simplicity of a batch file.i sometimes have a batch file create another batch file via echo > file.txt, perhaps that would be a better solution than trying to patch an existing script? Link to comment Share on other sites More sharing options...
maniaq Posted May 10, 2006 Author Share Posted May 10, 2006 copy and paste these lines into a file called source.bat:@ECHO off IF NOT [%1]==[] goto start ECHO. ECHO no command line argument passed. ECHO. GOTO :eof:startECHO argument passed = %1after that if for instance you ran source.bat d:\i386 the %1 variable would equal d:\i386, try the example for yourself.you can also set your own variables within the .bat code using set.for instance:set test=this is a testlater in your code %test% would equal this is a testthanks i have tested and it worked Link to comment Share on other sites More sharing options...
maniaq Posted May 10, 2006 Author Share Posted May 10, 2006 the next problem that i'm faced up is i don't know how to call cmd automatically when i extract files...first when i add files (included a .bat file) to sfx archive i select what file to run after extract and here i stop...i want to add a line for egzample "source.bat d:\i386" in command promt (when the files are beeing extracted). the reason i ask is because win xp source folder always changes. so is there any way i could do that? tnx Link to comment Share on other sites More sharing options...
ophiel Posted May 10, 2006 Share Posted May 10, 2006 instead of making a self-extracting archive, i would recommend using makecab to create a .cab archive of your files.then afterwards you would use a batch script like this to decompress:@echo offexpand myfiles.cab %1if the script was named filecopy.bat, you would call it like this: filecopy.bat d:\i386note: expand and makecab are microsoft utilities that come with xp Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now