Posts Tagged ‘Bios’

Robocopy Command

Posted: March 25, 2011 in Bios, Commands
Tags: ,

To run the Robocopy command you need to be in any of the two Servers.

Then open the command prompt and run the below command:

robocopy “\\source servername\Parent Foldername\Foldername” “\\destination server name\Parent Foldername\Foldername” /e /r:20

 

 

Advertisements

Now that you know how to work with variables and form expressions, let’s look at something more advanced: selection statements used with the command line. When you want to control the flow of execution based upon conditions known only at run time, you’ll use

  • if to execute a statement when a condition is true, such as if the operating system is Windows 2000 or later. Otherwise, the statement is bypassed.
  • if not to execute a statement when a condition is false, such as if a system doesn’t have a C:\Windows directory. Otherwise, the statement is bypassed.
  • if…else to execute a statement if a condition is matched (true or false) and to otherwise execute the second statement.

Although some of the previous examples in this chapter have used conditional execution, we haven’t discussed the syntax for these statements or the associated comparison operators. If your background doesn’t include programming, you probably will be surprised by the power and flexibility of these statements.

Using If

The if statement is used for conditional branching. It can be used to route script execution through two different paths. Its basic syntax is

if condition (statement1) [else (statement2)]

Here each statement can be a single command or multiple commands chained, piped, or grouped within parentheses. The condition is any expression that returns a Boolean value of True or False when evaluated. The else clause is optional, meaning you can also use the syntax

if condition (statement)
Tip Technically, parentheses aren’t required, but using them is a good idea, especially if the condition includes an echo statement or a command with parameters. If you don’t use parentheses in these instances, everything that follows the statement on the current line will be interpreted as part of the statement, which usually results in an error.

The if statement works like this: If the condition is true, then statement1 is executed. Otherwise statement2 is executed (if it is provided). In no case will both the if and the else clauses be executed. Consider the following example:

if "%1"=="1" (echo is one) else (echo is not one)

Here if the first parameter passed to the script is 1, then “is one” is written to the output. Otherwise, “is not one” is written to the output.

The command shell expects only one statement after each condition. Typically, the statement is a single command to execute. If you want to execute multiple commands, you’ll need to use one of the command piping, chaining, or group techniques, as in this example:

if "%1"=="1" (hostname & ver & ipconfig /all) else (netstat -a)

Here all three commands between parentheses will execute if the first parameter value is 1.

Using If Not

When you want to execute a statement only if a condition is false, you can use if not. The basic syntax is

if not condition (statement1) [else (statement2)]

Here the command shell evaluates the condition. If it is false, the command shell executes the statement. Otherwise, the command doesn’t execute and the command shell proceeds to the next statement. The else clause is optional, meaning you can also use the syntax

if not condition (statement1)

Consider the following example:

if not errorlevel 0 (echo An error has occurred!) & (goto :EXIT)

Here you check for error conditions other than zero. If no error has occurred (meaning the error level is zero), the command shell continues to the next statement. Otherwise, the command shell writes “An error has occurred!” to the output and exits the script. (You’ll learn all about goto and subroutines later in the chapter.)

Using If Defined and If Not Defined

The final types of if statements you can use are if defined and if not defined. These statements are designed to help you check for the existence of variables, and their respective syntaxes are

if defined variable statement

and

if not defined variable statement

Both statements are useful in your shell scripts. In the first case, you execute a command if the specified variable exists. In the second case, you execute a command if the specified variable does not exist. Consider the following example:

if defined numServers (echo Servers: %numServers%)

Here, if the numServers variable is defined, the script writes output. Otherwise, the script continues to the next statement.

Nesting Ifs

A nested if is an if statement within an if statement. Nested ifs are very common in programming, and command-shell programming is no exception. When you nest if statements, pay attention to the following points:

  1. Use parentheses to define blocks of code and the @ symbol to designate the start of the nested if statement.
  2. Remember that an else statement always refers to the nearest if statement that is within the same block as the else statement and that is not already associated with another else statement.

Here is an example:

if "%1"=="1" (
@if "%2"=="2" (hostname & ver) else (ver)) else (hostname & ver & 
netstat -a)

The first else statement is associated with if “%2″==”2”. The final else statement is associated with if “%1″==”1”.

Making Comparisons in If Statements

Frequently, the expression used to control if statements will involve comparison operators as shown in previous examples. The most basic type of string comparison is when you compare two strings using the equality operator (=), such as

if stringA==stringB statement

Here, you are performing a literal comparison of the strings and if they are exactly identical, the command statement is executed. This syntax works for literal strings but is not ideal for scripts. Parameters and arguments may contain spaces or there may be no value at all for a variable. In this case, you may get an error if you perform literal comparisons. Instead, use double quotation marks to perform a string comparison and prevent most errors, such as

if "%varA%"=="%varB%" statement

or

if "%varA%"=="string" statement

String comparisons are always case-sensitive unless you specify otherwise with the /i switch. The /i switch tells the command shell to ignore the case in the comparison, and you can use it as follows:

if /I "%1"=="a" (echo A) else (echo is not A)

These operators are used in place of the standard equality operator, such as

if "%varA%" equ "%varB" (echo The values match!)

Group Command Sequences

Posted: June 13, 2010 in Commands, System Information
Tags: ,


When you combine multiple commands, you may need a way to group commands to prevent conflicts or to ensure that an exact order is followed. You group commands using a set of parentheses. To understand why grouping may be needed, consider the following example. Here, you want to write the host name, IP configuration, and network status to a file, so you use this statement:

hostname & ipconfig & netstat -a > current-config.log

When you examine the log file, however, you find that it contains only the network status. The reason for this is that the command line executes the commands in sequence as follows:

  1. hostname
  2. ipconfig
  3. netstat – a > current_config.log

Because the commands are executed in sequence, the system host name and IP configuration are written to the command line, and only the network status is written to the log file. To write the output of all the commands to the file, you would need to group the commands as follows:

(hostname & ipconfig & netstat -a) > current_config.log

Here, the output of all three commands is collected and then redirected to the log file. You can also use grouping with conditional success and failure. In the following example, both Command1 and Command2 must succeed for Command3 to execute:

(cd C:\working\data & xcopy n:\docs\*.*) && (hostname >
n:\runninglog.txt)

As stated earlier in this chapter, the Windows XP/Windows Server 2003 boot sequence closely resembles that of Windows NT/2000. Listed below are the processes that take place when Windows NT-based operating system successfully starts on an x86-based computer:

  • Power On Self Test (POST)
  • Initial startup process
  • Boot loader process
  • Operating-system selection (if you have a multi-boot system)
  • Hardware detection
  • Hardware-profile selection
  • Kernel-loading process
  • Kernel-initialization process
  • User-logon process
Note The startup sequence quoted above applies to systems started or restarted after a normal shutdown. The startup processes begin when you do one of the following:

  • Turn on the computer
  • Reboot the system

However, this startup sequence does not apply when resuming from hibernate or standby modes.

When you log on, the process of loading Windows NT/2000, Windows XP, or Windows Server 2003 is completed, as well as are most of the initialization procedures. However, the startup can only really be considered as successfully completed after you log on to the system.

The following requirements need to be met to successfully begin the Windows NT/2000/XP/Windows Server 2003 startup:

  • Correct initialization of all the hardware.
  • Presence of all required files for starting the OS. If any of these files aren’t present in the correct folder or are corrupt, the startup will fail.

Power-on self-test (POST) is the common term for a computer, router or printer’s pre-boot sequence. The same basic sequence is present on all computer architectures. It is the first step of the more general process called initial program load (IPL), booting, or bootstrapping. The term POST has become popular in association with and as a result of the proliferation of the PC. It can be used as a noun when referring to the code that controls the pre-boot phase or when referring to the phase itself. It can also be used as a verb when referring to the code or the system as it progresses through the pre-boot phase. Alternatively, this may be called “POSTing.”

For embedded systems power-on self-test (POST) refers to the testing sequence that occurs when a system is first powered on. POST is software written to initialize and configure a processor and then execute a defined series of tests to determine if the computer hardware is working properly. Any errors found during the self-test are stored or reported through auditory or visual means, for example through a series of beeps, flashing LEDs or text displayed on a display. Once the POST sequence completes, execution is handed over to the normal boot sequence which typically runs a boot loader or operating system. POST for embedded systems has been around since the earliest days of computer systems.

On power up, the main duties of POST are handled by the BIOS, which may hand some of these duties to other programs designed to initialize very specific peripheral devices, notably for video and SCSI initialization. These other duty-specific programs are generally known collectively as option ROMs or individually as the video BIOS, SCSI BIOS, etc.

The principal duties of the main BIOS during POST are as follows:

  • verify the integrity of the BIOS code itself
  • find, size, and verify system main memory
  • discover, initialize, and catalog all system buses and devices
  • pass control to other specialized BIOSes (if and when required)
  • provide a user interface for system’s configuration
  • identify, organize, and select which devices are available for booting
  • construct whatever system environment that is required by the target OS

The BIOS will begin its POST duties when the CPU is reset. The first memory location the CPU tries to execute is known as the reset vector. In the case of a hard reboot, the northbridgewill direct this code fetch (request) to the BIOS located on the system flash memory. For a warm boot, the BIOS will be located in the proper place in RAM and the northbridge will direct the reset vector call to the RAM.

During the POST flow of a contemporary BIOS, one of the first things a BIOS should do is determine the reason it is executing. For a cold boot, for example, it may need to execute all of its functionality. If, however, the system supports power savings or quick boot methods, the BIOS may be able to circumvent the standard POST device discovery, and simply program the devices from a preloaded system device table.

The POST flow for the PC has developed from a very simple, straightforward process to one that is complex and convoluted. During POST, the BIOS must integrate a plethora of competing, evolving, and even mutually exclusive standards and initiatives for the matrix of hardware and OSes the PC is expected to support. However, the average user still knows the POST and BIOS only through its simple visible memory tests and setup screen.

Each user uses (or May not use) devices differently depending on the system setup. Nonetheless, some classes of devices are more commonly disabled than others. Knowing which ones will help you make your decision as to which devices you should disable. The following classes of devices are frequently disabled:

  • Network adapters: Especially on notebook computers, there is often more than one network device. Disabling the network devices that you do not use will definitely save you some booting time.
  • FireWire: If you have 1394 connections, otherwise known as FireWire, you might consider disabling them. Unless you are using your FireWire port to connect your digital video recorder to your computer, or have other external FireWire devices, you have no need to have this device enabled.
  • Biometrics: Some of the latest computer hardware includes biometric sensor equipment such as a fingerprint scanner. If you do not use these security features, you can save time by disabling these devices, too.
  • Modems: Do you have a broadband connection? If so, consider disabling your modem. If you rarely use it, why not disable it? If you ever need to use it again, just re-enable it.
  • TPM security chips: Does your computer have a Trusted Platform Module (TPM)? These chips are typically used as a secure place to store an encryption key that would be used for something such as hard drive encryption. If you are not using any of these advanced security features of Windows Vista, disable these devices, too.
  • Multimedia devices: Your computer has lots of multimedia devices. Take a look at the “Sound, video, and game controllers” section in Device Manager. You will find a lot of device drivers that are loaded during your boot. Some are used by all users, but you will find a few that you do not use. For example, I do not use my game port or my MIDI device, so I disabled both of those.
  • PCMCIA cards: If you are a laptop user, consider disabling your PCMCIA card controller located under “PCMCIA adapters.” The PCMCIA (Personal Computer Memory Card International Association) slot is a special expansion slot that is rarely used today on laptops except for wireless and wired network cards and card reader attachments for compact flash and other solid-state memory cards. Most laptops now have built-in network adapters, and some even have built-in wireless adapters. If you do not use your PCMCIA adapter, it is yet another device you can safely disable.

Important

Do not disable any hardware devices located under the Disk Drives, Computer, Display Adapters, IDE Disk Controllers, and the System sections (except for the system speaker). These hardware devices are critical to the operation of your system.

All systems initialize in more or less the same way. During the POST mentioned earlier, the BIOS checks the hardware devices and counts the system memory. Out of all the different types of system memory, the random access memory, better known as RAM, takes the longest to be checked. Checking the RAM takes time, and on a machine that has large amounts of RAM, this calculation can take several seconds. For example, a machine that has 512MB of RAM may take up to 3 seconds just to check the memory. On top of the RAM counting, a few other tests need to be done because your computer wants to make sure that all the hardware in your computer is working properly.

The complete version of these tests is not needed every time that you boot and can be turned off to save time. Most system BIOSs offer a feature called Quick Boot. This feature enables the user to turn off the full version of the test and sometimes enables you to run a shorter quick check test instead. Other BIOSs allow you to turn off the Memory Check only, which will still cut down on a lot of time.

To turn on the Quick Boot feature or to turn off the Memory Check, just do the following:

  1. Enter the system BIOS again by pressing F2 or the correct system setup Enter key on the POST screen for your system.
  2. After you are in the BIOS setup, locate the text “Quick Boot” or “Memory Check,”. Navigate with the arrow keys until the option is highlighted.
    Use the Change Value keys to cycle through the options and select Enable for the Quick Boot feature or Disable if your system’s BIOS has the Memory Check feature.
  3. After you have made the change to the setting, exit the system BIOS by pressing the Escape key. Make sure you save the changes upon exit.

Use of the Quick Boot feature or the disabling of the Memory Check will not do any harm your system. In fact, some computer manufacturers even ship their computers with these settings already optimized for performance. The only downside to disabling the tests is in the rare situation in which your RAM self-destructs; the BIOS will not catch it, and you might receive errors from the operating system or your system could become unstable. If you notice that your system becomes unstable and crashes frequently or will not even boot, go back into the BIOS and re-enable the tests to find out whether your system’s memory is causing the problems.

Different BIOS Entry Passwords

Posted: August 21, 2009 in Bios, System Basics
Tags:

Acer – CTL ALT ESC

AMI BIOS – DEL, F1 or F2

AST, Advantage, Award, Tandon – CTL ALT ESC

Award BIOS – DEL or CTL ALT ESC

Compaq – F10

DELL – F1 or DEL or CTL ALT ENTER

DTK BIOS – Esc

Gateway 2000 – F1

Hewlett Packard – F1

IBM
Older Models – In order to get into the configuration of the IBM setup screen CMOS screen you need to hold down both mouse buttons during bootup.

Aptiva – F1

PS/2 – CTL ALT INS after CTL ALT DEL

PS/2 with reference partition – INS

NEC – F2

Olivetti PC Pro – SHIFT CTL ALT Numpad DEL

Packard Bell – F1 or F2

Phoenix BIOS F1 or F2, or CTL ALT ESC or CTL ALT S or CTL S or CTL ALT INS

Sharp Laptop 9020 – F2

Sony – F3 at switchon, then F2 or F1

Tandon – CTL SHIFT ESC

Toshiba – ESC at switchon

Zenith – CTL ALT INS

Miscellaneous – CTL ESC or CTL ALT +