Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Starting a batch file at first run  (Read 12495 times)

0 Members and 1 Guest are viewing this topic.

foxhound

  • Guest
Starting a batch file at first run
« on: June 13, 2010, 09:37:56 AM »
I made a small script that silent installs some software for me. I was hoping to slipstream the software along with a Windows 7 installation but that's not an options as vLite failed for me.


So now I made a batch file that does the job. The problem is I need to run it once automatically the first time I log on.

Any ideas?

-Foxhound-

patio

  • Moderator


  • Genius
  • Maud' Dib
  • Thanked: 1769
    • Yes
  • Experience: Beginner
  • OS: Windows 7
Re: Starting a batch file at first run
« Reply #1 on: June 13, 2010, 09:44:53 AM »
What's the app and why do you say VLite failed ? ?
" Anyone who goes to a psychiatrist should have his head examined. "

foxhound

  • Guest
Re: Starting a batch file at first run
« Reply #2 on: June 13, 2010, 09:49:27 AM »
What's the app and why do you say VLite failed ? ?

There is quite a bit of applications to install, and no I prefer not to use ninite as I don't have interinet connection at first run and even if I did the bandwidth is way too low to download 20-30 applications that I need. But if you must know:

 *Firefox
* PDF reader
*JRE
 *CCleaner
 *Pidgin Messenger
*Tremulous (With backport)
*Notepad ++
 *Ultra ISO
*WinRAR
*uTorrent
*Virtual Box
*Avast Antivirus
*nVidia graphic drivers
lan/ethernet drivers
chipset drivers
HD audio drivers
smart card reader drivers
and a lot of games.

All of this is automated by the batch script, I really just need to figure out how to automatically run it at first start.

patio

  • Moderator


  • Genius
  • Maud' Dib
  • Thanked: 1769
    • Yes
  • Experience: Beginner
  • OS: Windows 7
Re: Starting a batch file at first run
« Reply #3 on: June 13, 2010, 09:51:00 AM »
Sorry but i still don't get it...
The apps should already be DLoaded in order to slipstream them into an install CD/DVD...
" Anyone who goes to a psychiatrist should have his head examined. "

foxhound

  • Guest
Re: Starting a batch file at first run
« Reply #4 on: June 13, 2010, 09:51:53 AM »
Well... the problem with that is, I can't make special settings and tweaks on the OS installation, which also comes in the batch file.

BC_Programmer


    Mastermind
  • Typing is no substitute for thinking.
  • Thanked: 1140
    • Yes
    • Yes
    • BC-Programming.com
  • Certifications: List
  • Computer: Specs
  • Experience: Beginner
  • OS: Windows 11
Re: Starting a batch file at first run
« Reply #5 on: June 13, 2010, 09:52:31 AM »
I'm not 100% if this is still the case but on some older windows versions (win95,98,2000) I believe it's possible to have a batch file start when windows starts by placing it in C:\windows or C:\windows\system32 and calling it "winstart.bat".
I was trying to dereference Null Pointers before it was cool.

Salmon Trout

  • Guest
Re: Starting a batch file at first run
« Reply #6 on: June 13, 2010, 01:07:23 PM »
Is nlite and the like even legal to discuss on this forum? Doesn't it violate the MS eula?

foxhound

  • Guest
Re: Starting a batch file at first run
« Reply #7 on: June 13, 2010, 03:04:19 PM »
Is nlite and the like even legal to discuss on this forum? Doesn't it violate the MS eula?

How would it violate the EULA?  ???
Anyway, I have yet to find a good way to solve the problem. I tried a knockoff project of vLite called RT7Lite but it crashed upon opening.   :-\


Salmon Trout

  • Guest
Re: Starting a batch file at first run
« Reply #8 on: June 13, 2010, 03:34:10 PM »
How would it violate the EULA?  ???
Anyway, I have yet to find a good way to solve the problem. I tried a knockoff project of vLite called RT7Lite but it crashed upon opening.   :-\



The EULA forbids reverse engineering, extraction of files, creating custom install disks, etc. I am not saying this is right or good or that I agree with it.

killerb255



    Adviser
  • Thanked: 35
    • Experience: Expert
    • OS: Windows 7
    Re: Starting a batch file at first run
    « Reply #9 on: June 13, 2010, 09:21:15 PM »
    Does the EULA forbid slipstreaming?  Microsoft has documentation for slipstreaming various hotfixes and Service Packs into OS installations anyway.  For the most part, nLite simply does the work for you (granted it allows you to do other things, like remove services and whatnot).

    For Windows 7, try RT Seven Lite.  It's basically vLite for Windows 7.

    With vLite, as long as you download the Windows Automated Installation Kit, or the "WAIK" (same kit for making Windows PE discs), it's legal.  I would imagine the same thing for RT Seven Lite. 

    And to answer the question about whether it's possible to start a batch with Windows, there are a few options for doing so:

    1) In XP: Copy the batch to C:\Documents and Settings\username (or All Users if you want it to start regardless of who logs in)\Start Menu\Programs\Startup

    In Vista and 7: Copy the batch to C:\Users\username\Start Menu\Programs\Startup (or C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup if you want it to start regardless of who logs in).

    2) Start -> Run -> gpedit.msc -> User Configuration -> Windows Settings -> Scripts (Logon/Logoff) -> right-click "Logon" -> Left-click "Properties" -> click "Add" -> click "Browse" -> paste your batch script there and select it.

    Of course the drawback to #1 and #2 is that it will run EVERY time you start up/log on.  For what you're looking for--having it run upon first logon after the OS is installed:

    3) Add an autounattend.xml file to the sources directory of the Windows 7 DVD and under Settings Pass: OOBESystem - MicrosoftWindows-Shell-Setup, add a FirstLogonCommands line to run your batch script.  The batch script itself would be stored under X:\sources\$oem$\$$ or X:\sources\$oem$\$1\scripts (substitute X with your DVD-ROM drive letter).  Anything under $$ gets copied to \windows\system32 and anything under $1 gets copied to the root of your boot drive (usually drive letter C). 

    I would imagine RT Seven Lite may have an option for editing your autounattend.xml file before it does its thing with the .wim file.

    For the exact syntax of <FirstLogonCommands>, go here:

    http://technet.microsoft.com/en-us/library/cc722150%28WS.10%29.aspx

    In a nutshell, it would be something like this:

    Code: [Select]
    <FirstLogonCommands>
       <SynchronousCommand wcm:action="add">
          <CommandLine>c:\batch\installmahschtuff.bat</CommandLine>
          <Description>This will install my schtuff.</Description>
          <Order>1</Order>
       </SynchronousCommand>
    </FirstLogonCommands>

    This is assuming that your Windows 7 DVD has an installmahschtuff.bat file under X:\sources\$oem$\$1\batch\installmahschtuff.bat (again, replace X with the drive letter of your DVD drive)

    If you don't want to create the autounattend.xml file yourself, and RT Seven Lite doesn't do it for you, use Windows System Image Manager.  That comes with the WAIK.
    Quote from: talontromper
    Part of the problem is most people don't generally deal with computer problems. So for most they think that close enough is good enough.