1. Welcome Guest! In order to create a new topic or reply to an existing one, you must register first. It is easy and free. Click here to sign up now!.
    Dismiss Notice

Registry/Run problem with .bat file.

Discussion in 'Windows Vista' started by Mobz, Oct 9, 2009.

  1. Mobz

    Mobz Guest

    I`m having some problems with an automatic application/updates installer
    script.

    I have 3 different bat files, the 1st one containing different
    applications to install without user interruption, works fine. And the
    2nd bat file containing Service Pack 2 installation, unattended install.
    And finally the 3rd bat file installs different windows update files,
    also unattended. And they all works perfectly fine, exactly as i want
    them to do

    Problem:
    That i have to be there when the computer restarts after bat1 to start
    bat2 and finally to start bat 3. (Ive written a script in the first bat
    file that turns off the UAC prompt, and then when almost finished with
    the 3rd one turns it on again).

    Solution (I tought):
    Would be to write to the registry run command and then when its done
    delete the entries in registry. And that works fine.
    Code (example):
    -set var=%~dp0
    REG ADD HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\run
    /v Testauto /t REG_SZ /d %var%BAT2.bat
    shutdown /r /f /t 05-

    Why i have "-set var=%~dp0-" is because its stored on a usb stick, and
    that it will be given different drive paths on different computers.

    Register entry:
    Data name:Testauto Datavalue: G:\BAT2.bat
    And everything looks good, exactly as i want.

    Unsolved problem:
    When my computer restarts it starts the BAT2.bat with all the commands
    ive given it.
    But it doesnt run from the G:\BAT2.bat> *all commands*. It starts the
    commands from C:\windows\system32 >BAT2.bat>*all commands*. Why???
    If i for example open the run box, and type:G:\BAT2.bat it starts as
    its supposed to.
    Its like when it starts from the run in registry, its just call the bat
    file from cmd.exe.
    And in registry it all looks as its supposed to.

    Please tell me someone has a solution for this problem, because it
    starts to drive me crazy. (Sorry for my bad english im from Sweden).

    Very very much thanks in advance.

    /Mobz


    --
    Mobz
     
  2. lemur

    lemur Guest

    please don't cross post. thank you.


    --
    lemur

    ::If *ANYONE* in this forum helps you, please click on
    their *REP* icon. Thanks! (the middle scale icon in the upper right
    corner)::
     
  3. On Fri, 9 Oct 2009 19:41:46 -0500, lemur wrote:
    <!--coloro:blue--><span style="color:blue <!--/coloro-->
    > please don't cross post. thank you.<!--colorc--><!--/colorc-->

    1. The original post is posted to only one newsgroup, namely
    microsoft.public.windows.vista.general. Look at the headers.

    2. What's wrong with cross-posting? It's done all the time when two or
    three groups are appropriate to the subject, although posting to more
    newsgroups than that is often deprecated.

    3. Many newsreaders let you suppress posts that are cross-posted to more
    than n groups, where n is your choice. Maybe you should think of getting
    one of those so you could read newsgroups in situ instead of via vBulletin
    USENET gateway (whatever that might be, it seems not to be a real
    newsreader). Then you'd be in charge of your own experience, and you
    wouldn't have to give orders to strangers.

    --
    Gene E. Bloch letters0x40blochg0x2Ecom
     
  4. Tae Song

    Tae Song Guest

    "Mobz" <guest@unknown-email.com> wrote in message
    news:97fbc62eb6fcf75534b6e3cc88529540@nntp-gateway.com...<!--coloro:blue--><span style="color:blue <!--/coloro-->
    >
    > I`m having some problems with an automatic application/updates installer
    > script.
    >
    > I have 3 different bat files, the 1st one containing different
    > applications to install without user interruption, works fine. And the
    > 2nd bat file containing Service Pack 2 installation, unattended install.
    > And finally the 3rd bat file installs different windows update files,
    > also unattended. And they all works perfectly fine, exactly as i want
    > them to do
    >
    > Problem:
    > That i have to be there when the computer restarts after bat1 to start
    > bat2 and finally to start bat 3. (Ive written a script in the first bat
    > file that turns off the UAC prompt, and then when almost finished with
    > the 3rd one turns it on again).
    >
    > Solution (I tought):
    > Would be to write to the registry run command and then when its done
    > delete the entries in registry. And that works fine.
    > Code (example):
    > -set var=%~dp0
    > REG ADD HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionrun
    > /v Testauto /t REG_SZ /d %var%BAT2.bat
    > shutdown /r /f /t 05-
    >
    > Why i have "-set var=%~dp0-" is because its stored on a usb stick, and
    > that it will be given different drive paths on different computers.
    >
    > Register entry:
    > Data name:Testauto Datavalue: G:BAT2.bat
    > And everything looks good, exactly as i want.
    >
    > Unsolved problem:
    > When my computer restarts it starts the BAT2.bat with all the commands
    > ive given it.
    > But it doesnt run from the G:BAT2.bat> *all commands*. It starts the
    > commands from C:windowssystem32 >BAT2.bat>*all commands*. Why???
    > If i for example open the run box, and type:G:BAT2.bat it starts as
    > its supposed to.
    > Its like when it starts from the run in registry, its just call the bat
    > file from cmd.exe.
    > And in registry it all looks as its supposed to.
    >
    > Please tell me someone has a solution for this problem, because it
    > starts to drive me crazy. (Sorry for my bad english im from Sweden).
    >
    > Very very much thanks in advance.
    >
    > /Mobz
    >
    >
    > --
    > Mobz<!--colorc--><!--/colorc-->


    Be honest, did you lift this code from somewhere and tried to modify it?

    The error is glaringly obvious.
     

Share This Page