Welcome to MSFN

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.


ewilliams

Create .bat file to run after windows install

19 posts in this topic

I own a small computer repair shop and am trying to make a .bat file run directly after the installation of windows is finished. I will need it for windows 7 and xp. Here is my .bat file

Set RegQry=HKLM\Hardware\Description\System\CentralProcessor\0
REG.exe Query %RegQry% | Find /i "x86"
If %ERRORLEVEL% == 0 (
GOTO X86
) ELSE (
GOTO X64
)


:X86

@echo off
REG ADD "HKCU\SOFTWARE\MICROSOFT\INTERNET EXPLORER\MAIN" /V "START PAGE" /D "http://facebook.com/pcmscomputers" /F
start iexplore http://facebook.com/pcmscomputers
"1 MSE Win 7 - 32.exe"
"Flash 32.exe"
"2 Drivers.exe"

GOTO END

:X64

@echo off
REG ADD "HKCU\SOFTWARE\MICROSOFT\INTERNET EXPLORER\MAIN" /V "START PAGE" /D "http://facebook.com/pcmscomputers" /F
start iexplore http://facebook.com/pcmscomputers
"1 MSE Win 7 - 64.exe"
"Flash 64.exe"
"2 Drivers.exe"

:End

Edited by Tripredacus
0

Share this post


Link to post
Share on other sites

If I may, simpler ;):

@echo off

SET Bits=64

Set RegQry=HKLM\Hardware\Description\System\CentralProcessor\0

REG.exe Query %RegQry% | Find /i "x86"

If %ERRORLEVEL% == 0 SET Bits=32

REG ADD "HKCU\SOFTWARE\MICROSOFT\INTERNET EXPLORER\MAIN" /V "START PAGE" /D "http://facebook.com/pcmscomputers"'>http://facebook.com/pcmscomputers" /F

start iexplore http://facebook.com/pcmscomputers

"1 MSE Win 7 - %Bits%.exe"

"Flash %Bits%.exe"

"2 Drivers.exe"

But what was the actual question? :unsure:

jaclaz

0

Share this post


Link to post
Share on other sites

I am trying to make that .bat file automatically run directly after finishing the windows installation

0

Share this post


Link to post
Share on other sites

I am trying to make that .bat file automatically run directly after finishing the windows installation

You can put that bat file or its shortcut in the startup folder, it will run automatically on first logon.

0

Share this post


Link to post
Share on other sites

I know I could do that but I am trying to not have to click on it or anything. If I add it to the start menu I would be better off just clicking to start it then waiting for it to restart.

0

Share this post


Link to post
Share on other sites

I am trying to make that .bat file automatically run directly after finishing the windows installation

You can put that bat file or its shortcut in the startup folder, it will run automatically on first logon.

I know I can do that. But then I would have to restart the computer. I would be better off just clicking on the .bat file. I am trying to do it like in the Setupcomplete.cmd or something to that nature

0

Share this post


Link to post
Share on other sites

Although you are likely installing 64-bit onto every unit with a 64-bit CPU, I would suggest that you check the 'bitness' of the Operating System not that of the Hardware.

Using a 'batch file', (your request), you can probably do this with WMIC.

The following three lines could replace the first five lines previously provided by jaclaz

@ECHO OFF&SETLOCAL
SET "Bits=32"
WMIC OS GET OSARCHITECTURE|FIND "64">NUL&&SET "Bits=64"

Off Topic, I think that you are very wrong opening someone's Internet Explorer browser without them having had the opportunity to configure or update/patch it first.

0

Share this post


Link to post
Share on other sites

Although you are likely installing 64-bit onto every unit with a 64-bit CPU, I would suggest that you check the 'bitness' of the Operating System not that of the Hardware.

Using a 'batch file', (your request), you can probably do this with WMIC.

The following three lines could replace the first five lines previously provided by jaclaz

@ECHO OFF&SETLOCAL
SET "Bits=32"
WMIC OS GET OSARCHITECTURE|FIND "64">NUL&&SET "Bits=64"

Off Topic, I think that you are very wrong opening someone's Internet Explorer browser without them having had the opportunity to configure or update/patch it first.

I am opening it going to only that page just to make sure everything is functioning correctly

But still can anyone help me?????????????

0

Share this post


Link to post
Share on other sites
I am opening it going to only that page just to make sure everything is functioning correctly

All you are doing is forcing a specific web page with a specific browser, that really isn't an test of the effectiveness/stability of your installation onto their hardware. Apart from that, I'm not naive, If you were simply checking functionality on a one time only basis why have you set it as their start page too?

Additionally, I see no reason to force flashplayer and MSE on every customer either, (if someone requires flash they will be given the opportunity to install it from most sites using it, and MSE is not everyone's choice, only yours, some may prefer a full security suite or free products from companies like BitDefender or AVIRA.

BTW, if you wish to receive a response to your question, you'd be more likely to get your wish if you provided a reasonably detailed explanation on which method(s) of installation you are using with each specific Operating System.

0

Share this post


Link to post
Share on other sites
I am opening it going to only that page just to make sure everything is functioning correctly

All you are doing is forcing a specific web page with a specific browser, that really isn't an test of the effectiveness/stability of your installation onto their hardware. Apart from that, I'm not naive, If you were simply checking functionality on a one time only basis why have you set it as their start page too?

Additionally, I see no reason to force flashplayer and MSE on every customer either, (if someone requires flash they will be given the opportunity to install it from most sites using it, and MSE is not everyone's choice, only yours, some may prefer a full security suite or free products from companies like BitDefender or AVIRA.

BTW, if you wish to receive a response to your question, you'd be more likely to get your wish if you provided a reasonably detailed explanation on which method(s) of installation you are using with each specific Operating System.

Most of my customers are around 50 years old and just want antivirus I set the homepage to my company facebook just so they can get updates they are free to change anything they wish. I just do that by default. I use a new windows installation and key for each install.

0

Share this post


Link to post
Share on other sites

Yzöwl good grief

nothing wrong with that every dang OEM on this earth plants a bunch of garbage pointing to their websites. I've been in all of them.

Adding MSE is better than all the other garbage OEM do, 60 day trial's

XP is a little old and uses stuff unlike Win 7. With 7 you can add an xml and even add your webpage to it. You would want to call the bat in OOBEsystem most likely since mse can't install silently you must have it up and running and click through the dialogues. Examples here

Read this earlier but was working on something else and would have to think of best way in XP

0

Share this post


Link to post
Share on other sites

Yzöwl good grief

nothing wrong with that every dang OEM on this earth plants a bunch of garbage pointing to their websites. I've been in all of them.

Adding MSE is better than all the other garbage OEM do, 60 day trial's

XP is a little old and uses stuff unlike Win 7. With 7 you can add an xml and even add your webpage to it. You would want to call the bat in OOBEsystem most likely since mse can't install silently you must have it up and running and click through the dialogues. Examples here

Read this earlier but was working on something else and would have to think of best way in XP

Huh?, ofcouse you can install MSE silently.

0

Share this post


Link to post
Share on other sites

yep forgot about the /s /runwgacheck. I generally run through it to set my settings like scan daily and time since reg key has permissions on it

Edited by maxXPsoft
0

Share this post


Link to post
Share on other sites

Yzöwl good grief

nothing wrong with that every dang OEM on this earth plants a bunch of garbage pointing to their websites. I've been in all of them.

Adding MSE is better than all the other garbage OEM do, 60 day trial's

Of course there's something wrong with that; my issue isn't with sending someone to your website, it's with forcing it on first installation using a specific browser. Also if your doing this at your workplace you're likely connecting through a wired network, not the customers network. (so you are effectively testing the functioning in an environment under which it will not be used). If you are installing it at the customers premises then it is unlikely to work since their, usually wireless, network has not yet been configured.

The prudent thing to do if your happy to force stuff on your customer like this would be to have this run once when they receive the PC and have set it up to their liking, and use a URL which is not linked to a specific browser.

On the issue of software installation I'm afraid I'll never agree with condoning this practice. It is rude to force a particular piece of software onto someone else's machine, you should at least give them an on screen choice, the same way Microsoft had to with browsers.

That said, the entire thought process here needs looking at. If I install a 64-bit Operating System onto a PC I'll already know that this will in turn involve installing 64-bit software where available; I certainly wouldn't need a batch file to work that out for me. I see no real benefit in creating a single installation media which installs both 32 and 64-bit and which is only as up to date as the versions of software integrated.

0

Share this post


Link to post
Share on other sites

Ok it is not on customer machines it is on computers I am selling but thanks for everything I will try to find help elsewhere

0

Share this post


Link to post
Share on other sites

Well you are free of course to do that, however I'd suggest that if you venture elsewhere for a solution you'd be advised to:

  • Answer questions posed.
    which as yet you've failed to do here.
  • Tell the truth!
    which you've admitted failing to do here.

We are not going to provide you with every possible answer in the hope that one will suit you and your situation. It is your responsibility to provide sufficient information in order that we can tailor responses to suit, (otherwise we could just tell you to read the guides and forum since your solution is most definitely among them).

0

Share this post


Link to post
Share on other sites

You feelin bad or something Yzöwl cause I didn't see none of that in his things.

He just repairs and builds PC's as I only do part time and they are generally XP or Win 7

He just trying to automate things a little.

People get their selves in trouble and if I have to I format and reinstall and generally I will install a free MSE cause it simply works on both and I know what to tell them if they call. They want to change it they more than welcome and I'll help them best I can with what they prefer but most PC user's don't understand Anykey. 40% of them will ask me to tell them how to change their startup to Facebook since it's going thing or either they know how. The rest don't care

I used to install Firefox on them and recommend they use that over IE because it's safer but 90% won't. They want to use what they know here in the US (IE) and feel ok with I guess. I use Maxthon now

Installing Flash is a no brainer, most the short movies are flash like on youtube and instead of waisting time walking some of these people through that I install it also for each browser i put in.

I'll also put on Adobe Reader so they can read the pdf's and I don't waste my time telling them what to do if they have to install it.

IMHO: These forums are bare these day's and sending people off is not a good thing

And only IE I save this whole page to .mht, such a good thing. Only browser will

@wazer

I finally worked out my SetACL where I can change the settings in the protected registry key's so now I can install silent and run it and set the key's back to where they should be.


SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx
REG ADD %KEY% /V TITLE /D "RunOnceEx - Testing Applications" /f
REG ADD %KEY% /v Flags /t REG_DWORD /d "20" /f

REG ADD %KEY%\1001 /VE /D "Microsoft Security Essentials x64" /f
REG ADD %KEY%\1001 /V 101 /D "CMD /C Start /Wait D:\APPS\MS_SecurityEssentials_x64\mseinstall.exe /s /runwgacheck" /f
REG ADD %KEY%\1001 /V 102 /D "CMD /C Start /Wait D:\APPS\MS_SecurityEssentials_x64\SecurityEssentials64.cmd" /f

0

Share this post


Link to post
Share on other sites

You feelin bad or something Yzöwl cause I didn't see none of that in his things.

I'm not interested in your reasoning behind installing rubbish software onto other peoples machines, suffice it to say that I will never agree to it. (most of my PC work has been based around removing unwanted pre-installed software and viruses from OEM's ill chosen anti-malware solutions).

That however is only a minor irritation, there are two main issues here:

  1. The OP has provided no information whatsoever on which method they are using for installing Windows XP or for installing Windows 7 onto these machines for 50 year olds.
    (both completely different and only one of which is covered in this particular forum area)
  2. The batch file they are requesting help with indicates a poorly thought out system. Why go to the lengths of creating a single media which deploys both 64-bit and 32-bit. This means relying on the batch to make the software installation determination for you and having to manually rename a bunch of files so that each can be identified by the batch according to the bitness.
    (when you create installation media, there is no real benefit in integrating both 32-bit and 64-bit on that same media. It is extra work just to save on the cost of another blank DVD. You create 32-bit OS installation media complete with 32-bit software installations, (if you're happy to do this very frequently), then replicate the process with the 64-bit OS and 64-bit software. (Even Microsoft provide a separate disk for each).

People need to be mindful not to fall into the trap of spending more time creating and updating media than the time saved by using it!

<Edit />

I also notice that not once has the OP thanked any single contributor to this Topic for the pertinent responses they provided.

Edited by Yzöwl
See <Edit />
0

Share this post


Link to post
Share on other sites

I'll just leave a note in here about Flash player... If you are installing Flash player on computers for sale or resale, and are operating as a business, you need to get a redist agreement from Adobe. I run into clients trying this all the time without said agreement.

http://www.adobe.com/products/players/flash-player-distribution.html

Its a CYA thing. ;)

0

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.