Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account



Photo

CMD: OPTION to jump

- - - - -

  • Please log in to reply
32 replies to this topic

#26
Yzöwl

Yzöwl

    Wise Owl

  • Super Moderator
  • 4,537 posts
  • Joined 13-October 04
  • OS:Windows 7 x64
  • Country: Country Flag

Donator

For /R without a path should walk the tree rooted from the current directory. If the file is run from within that directory you will be fine, if you run it from elsewhere or the 'compiler' runs it from a temporary directory, it will walk the wrong path structure.

What I would suggest is that if your 'compiler' is unable to handle something as simple as %0 derivatives , then it really doesn't serve much purpose unless you always have control over the environment within which it will be run.

The script could be edited/modified to run each update echoing a count to the screen.


How to remove advertisement from MSFN

#27
Caml Light

Caml Light

    Junior

  • Member
  • Pip
  • 85 posts
  • Joined 03-October 03
Hi Yzöwl! :hello:

Is it possible to add the log support to your code below? I try to explain me better... During every installation, in this case of Windows hotfixes, is it possible to save to a file (.log or .txt) what is happening?

For example, the log file shoud be:

Installation of KB123456....
Installation of KB234567....
Installation of KB345678....

and so on...

(Congratulations for your batch, you helped me very much!!)

@ECHO OFF
ECHO=_%~1|FINDSTR/X "_-123456 _/123456">NUL 2>&1||GOTO Error
SETLOCAL ENABLEEXTENSIONS
SET "_="
PUSHD %~dp0
FOR /R %%A IN (Windows*-KB*.EXE) DO (
        SET _=T
        ECHO= Installazione di %%~nA in corso...
        >NUL PING -n 4 127.0.0.1
        "%%A" /quiet /norestart)
IF NOT DEFINED _ GOTO Error
ECHO=
ECHO= == Press any key to restart. ==
>NUL PAUSE
SHUTDOWN.EXE /r /t 0
GOTO :EOF
:Error
ECHO= Error.
ECHO=
ECHO= Press any key to exit...
>NUL PAUSE


#28
allen2

allen2

    Not really Newbie

  • Member
  • PipPipPipPipPipPipPip
  • 1,812 posts
  • Joined 13-January 06
You just need to add a ">c:\path_you_want\logfile.log" at the end of each echo command.

#29
Caml Light

Caml Light

    Junior

  • Member
  • Pip
  • 85 posts
  • Joined 03-October 03
thanks!! Anyway, i've tried with a only ">" and the log register only this: "ECHO= == Press any key to restart. =="

While with two ">>" the log register all installations. Do you know why?

#30
bphlpt

bphlpt

    MSFN Addict

  • Member
  • PipPipPipPipPipPipPip
  • 1,798 posts
  • Joined 12-May 07
  • OS:none specified
  • Country: Country Flag
One ">" means, roughly, "redirect output and write to here", ie open the file, write the info (replacing whatever was there), and close the file.
Two ">>" means, roughly, "redirect output and append to here", ie open the file, write the info (adding to the end of whatever was there), and close the file.

Cheers and Regards

Edited by bphlpt, 05 September 2011 - 11:45 PM.

Posted Image


#31
Caml Light

Caml Light

    Junior

  • Member
  • Pip
  • 85 posts
  • Joined 03-October 03
Thank you! :yes:

Fortunately there are you guys!

#32
Caml Light

Caml Light

    Junior

  • Member
  • Pip
  • 85 posts
  • Joined 03-October 03
Hi!!!! I'm thinking that it would be nice if the batch could skip the ECHO of the updates not installed. For example, if i put some hotfixes for x64 architecture on a x86 S.O., actually the installation is skipped, but the ECHO not. Is it feasible?

#33
Caml Light

Caml Light

    Junior

  • Member
  • Pip
  • 85 posts
  • Joined 03-October 03
Hi guys! taking this script:

@ECHO OFF
COLOR F9
ECHO=_%~1|FINDSTR/X "_-? _/?">NUL 2>&1||GOTO Error
SETLOCAL ENABLEEXTENSIONS
SET "_="
PUSHD %~dp0

FOR /R %%A IN (ApplicationSetup.EXE) DO (
        SET _=T
        ECHO=Installation of %%~nA...>>install.log
        >NUL PING -n 4 127.0.0.1
:: Extracting ApplicationSetup file
        "%%A" /S
:: Killing processes that automatically start
        bin\KillProcess Setup.exe
        bin\KillProcess InstallApp.exe
:: Start Silent Installation of the extracted files
        %SystemDrive%\ApplicationSetup\%%~nA\Setup.exe /S
:: Delete Folder where ApplicationSetup is extracted
        RD /S /Q %SystemDrive%\ApplicationSetup)

IF NOT DEFINED _ GOTO Error
:: ECHO=>>install.log
ECHO=Install complete.>>install.log
>NUL PING -n 4 127.0.0.1
EXIT
GOTO :EOF

:Error
ECHO=Error.>>install.log
>NUL PAUSE


So, for you is it correct? Is it better to add "START /WAIT" at the begin of every command?
This script works, but i want to be sure that it can't give me errors.

Thank you in advance!!

Edited by Caml Light, 24 October 2011 - 06:09 AM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users