08-10-2006, 02:46 AM
|
#1 (permalink)
|
|
Senior Member
Join Date: Aug 2006
Referrals: : 0
Posts: 295
Points: 7,736.40
Bank: 0.00
Total Points: 7,736.40
|
Software installation via .bat file
I’m trying to setup a silent installation of some custom built software via a batch file. Problem is that the setup.exe requires a reboot following the installation, and then you have to move some files from a network share to an existing folder on the c: drive. I’ve been looking all over the web for a solution within the script. I built the script, and got it to map my network drives, run the software from the network, and reboot the pc… but I don’t know how to command the same script to copy these files from the network share following the reboot without me having to double click on a second .bat file. Do you guys know of a way to make the script force the reboot, and pick up where it left off following the reboot? Or do I just have to create two separate scripts to do one installation of this software??
I tried inserting a few different commands ( i.e.
start "" /wait %systemdrive%\install\some_application\setup.exe )
or
(start "" %systemdrive%\install\some_application\setup.exe /sleep #30)
but I don't even exactly know if I used these in the proper format..??
PLEASE HELP!! I've been pulling my hair out for DAYS over this!
|
|
|
08-10-2006, 02:47 AM
|
#2 (permalink)
|
|
Senior Member
Join Date: Aug 2006
Referrals: : 0
Posts: 228
Points: 5,448.63
Bank: 0.00
Total Points: 5,448.63
|
make the first batch file copy a second batch file into the
C:\Documents and Settings\All Users\Start Menu\Programs\Startup\
directory... make that 2nd .bat your file copying script... then make it delete itself. That's how I do it!
|
|
|
08-10-2006, 02:47 AM
|
#3 (permalink)
|
|
Senior Member
Join Date: Aug 2006
Referrals: : 0
Posts: 295
Points: 7,736.40
Bank: 0.00
Total Points: 7,736.40
|
pardon my ignorance man... how will this cause the second script to automatically run following the reboot though?
thanks for the feedback
|
|
|
08-10-2006, 02:47 AM
|
#4 (permalink)
|
|
Senior Member
Join Date: Aug 2006
Referrals: : 0
Posts: 228
Points: 5,448.63
Bank: 0.00
Total Points: 5,448.63
|
Because everything in the startup folder runs at startup. So the re-boot will run the script/batch file.
|
|
|
08-10-2006, 02:48 AM
|
#5 (permalink)
|
|
Senior Member
Join Date: Aug 2006
Referrals: : 0
Posts: 295
Points: 7,736.40
Bank: 0.00
Total Points: 7,736.40
|
Learn more about scripting here
|
|
|
08-10-2006, 02:48 AM
|
#6 (permalink)
|
|
Senior Member
Join Date: Aug 2006
Referrals: : 0
Posts: 228
Points: 5,448.63
Bank: 0.00
Total Points: 5,448.63
|
OH!! I'm starting to understand this stuff now. Alright guys... Here's what my first script looks like:
@echo on
rem Connect network drives
if exist m:\*.* net use m: /d
net use m: \\%SERVER%\%subfolder% /persistent:no /pause
copy m:\install\batchfile.bat
C:\Documents and Settings\All Users\Start Menu\Programs\Startup /pause
start /wait m:\Test\Setup.exe /pause
echo.
exit
Following the reboot, it should theoretically run the following script (the one I copied into the startup folder) Of course, these scripts are merely for testing purposes until I nail the format, so I can create the actual install .bat.
Second Script:
@echo on
echo.
copy M:\test\test.doc
c:\test /pause
echo.
copy M:\test\test.txt
c:\test /pause
echo.
copy M:\test\test.bmp
c:\test /pause
echo.
******* END *******
echo.
exit
Thanks alot for your help thus far guys. Wish me luck now.. Time to test my test scripts!!
|
|
|
08-10-2006, 02:49 AM
|
#7 (permalink)
|
|
Senior Member
Join Date: Aug 2006
Referrals: : 0
Posts: 295
Points: 7,736.40
Bank: 0.00
Total Points: 7,736.40
|
That idea didn't work. it's mapping my network drive, running the setup.exe. but it won't copy the second .bat file from the network share to C:\Documents and Settings\All Users\Start Menu\Programs\Startup
I even tried to have it copy from the network drive to c:\documents and settings\administrator\start menu\programs\startup
still nothing. won't copy; won't run following the reboot.
any ideas?? thanks alot guys! you've been ridiculously helpful!
|
|
|
08-10-2006, 02:50 AM
|
#8 (permalink)
|
|
Senior Member
Join Date: Aug 2006
Referrals: : 0
Posts: 295
Points: 7,736.40
Bank: 0.00
Total Points: 7,736.40
|
Root path of the C:\?
so it would look like this right?:
copy %networkdrive%\batch.bat c:\$
Does that look right?
|
|
|
08-10-2006, 02:50 AM
|
#9 (permalink)
|
|
Senior Member
Join Date: Aug 2006
Referrals: : 0
Posts: 228
Points: 5,448.63
Bank: 0.00
Total Points: 5,448.63
|
But a bat file in the startup folder. Put the actual bat file in the root, C:\. I think the path is too long. Have the bat file in the startup folder call the bat file in the root. If you need it to execute commands copy the file with the commands otherwise copy a blank bat file with some rem statements.
|
|
|
08-10-2006, 02:51 AM
|
#10 (permalink)
|
|
Senior Member
Join Date: Aug 2006
Referrals: : 0
Posts: 295
Points: 7,736.40
Bank: 0.00
Total Points: 7,736.40
|
Let's say the presence of a file called ctrl.txt will identify the need to run the script.
2) We will manually intall a file called runme.bat into the startup folder
3) Runme.bat will consist of the following lines
@ echo off
cls
echo Running Network setup......
call c:\batch.bat
4) You will have two batch files one will be a dummy called inactive.bat and the other will have the commands called active.bat.
5) The basic batch file logic would be:
@ echo off
if exist c:\ctrl.txt go active
copy inactive.bat c:\batch.bat>nul
goto done
:active
copy active.bat c:\batch.bat>nul
goto done:
:done
cls
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
Points Per Thread View: 1.00
Points Per Thread: 15.00
Points Per Reply: 5.00
|
|
|
|
|
|