Archive for the ‘Commands’ Category

The /32 and /64 parameters for the mmc command are meaningful only on 64-bit Windows versions. The 64-bit versions of the Windows operating system can run both 32-bit and 64-bit versions of the MMC. For 32-bit versions of the MMC, you use 32-bit snap-ins. For 64-bit versions of the MMC, you use 64-bit snap-ins. You can’t mix and match MMC and snap-in versions, though. The 32-bit version of the MMC can be used only to work with 32-bit snap-ins. Similarly, the 64-bit version of the MMC can be used only to work with 64-bit snap-ins. In most cases, if you aren’t sure which version to use, don’t use the /32 or /64 parameter. This lets the Windows operating system decide which version to use based on the snap-ins contained in the .msc file you are opening.

 

When a console contains both 32-bit and 64-bit snap-ins and you don’t specify the /32 or /64 parameter, Windows will open a subset of the configured snap-ins. If the console contains more 32-bit snap-ins, Windows will open the 32-bit snap-ins. If the console contains more 64-bit snap-ins, Windows will open the 64-bit snap-ins. If you explicitly use /32 or /64 with a console that contains both 32-bit and 64-bit snap-ins, Windows will open only the snap-ins for that bitness. On 64-bit systems, 32-bit versions of snap-ins are stored in the %SystemRoot%\SysVoL64 folder and 64-bit versions of snap-ins are stored in the %SystemRoot%\System32 folder. By examining the contents of these folders, you can determine when 32-bit and 64-bit versions of snap-ins are available.

Advertisements

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

 

 

To search Particular set of File Types in a large set of Folders or in a drive, Instead of Windows Search which take long time usually, You can Run a Command which gives you the Log File with the Details of the File name, Location, Drive, space consumed.

To Proceed to Search the files:

1. Open Command Prompt

2. Get to Root Directory (i.e The Drive name in which you want to search)

3. Run the Command “dir /b /n /s *.wma,*.mp3,*.mp4,*.avi,*.mpg,*.mov,*.jpg,*.bmp >C:\ drivespace.txt”

 

You can search any kind of file by editing the above command, I have shown the command to search the Media and Photo files.

The Part (>c:\drivespace.txt) : here you can mention the file name and the path to save the file after execution.

 

Net Use Command:

 

To Add a Drive

net use (drive-name): \\Servername\Foldername :persistent

 

To Delete a Mapped Drive

net use (Drivename): /del                           or                                net use (Drivename): /delete

 

In case if you get any error while running the Net use command like : NET NOT RECOGNIZED AS A COMMAND

Then Follow the Below Steps:

Open Command Prompt> Go To “C” Drive> “Windows” Folder> “System 32″ Folder”

and then run the Net Use Command mentioned above.

Also check the below Value:

HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\Path

I suspect it is a Reg_SZ value. It should be a Reg_Expand_SZ value

 

CHKDSK —  Creates and displays a status report for a hard disk and can correct errors on the disk if required. Used without any parameters, CHKDSK simply displays the status of the disk in the current drive. Used with parameters. CHKDSK can locate bad sectors, repair the disk and recover readable information.

To see a status report of the disk, at a command prompt, type, chkdsk and press ENTER. If errors are found, any error message will appear.

To repair errors with the disk, at the command prompt, type chkdsk /f/r and press ENTER. The parameter /f fixes errors on the disk, /r locates bad sectors and recovers readable information. If  you receive a message that chkdsk cannot run because the volume is in use by another process, this probably means that you are trying to fix errors  on the disk that you are currently using. You cannot do that but the computer can repair errors at startup, and you should schedule an autostart in the bootup.

There are several advanced Command Line tools, created and intended  for Network Administrators and advanced users, If interested, try with this command line prompts;

> Bootcfg — Use this command to configure, query or change the boot.ini file settings. Be careful about making changes here !!

>Gpresult — Use this command to test group policy and obtain general information about the operating system, the user and the computer including the build number and the service pack details, user name, domain name, profile type, security privileges, disk quota information and the last time the policy was applied.

>Recover — Use this command to recover readable information from a bad or defective disk.

> Schtasks — Use this command to schedule programs to run at a specific time or at specified intervals.

To see a complete list of available commands for Windows XP including the latest editions, check the Command Line Reference.

All mIRC Commands

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

/ Recalls the previous command entered in the current window.

/! Recalls the last command typed in any window.

/action {action text} Sends the specifed action to the active channel or query window.

/add [-apuce] {filename.ini} Loads aliases, popups, users, commands, and events.

/ame {action text} Sends the specifed action to all channels which you are currently on.

/amsg {text} Sends the specifed message to all channels which you are currently on.

/auser {level} {nick|address} Adds a user with the specified access level to the remote users

list.

/auto [on|off|nickname|address] Toggles auto-opping of a nick or address or sets it on or off

totally.

/away {away message} Sets you away leave a message explaining that you are not currently paying

attention to IRC.

/away Sets you being back.

/ban [#channel] {nickname} [type] Bans the specified nick from the curent or given channel.

/beep {number} {delay} Locally beeps ‘number’ times with ‘delay’ in between the beeps. /channel

Pops up the channel central window (only works in a channel).

/clear Clears the entire scrollback buffer of the current window.

/ctcp {nickname} {ping|finger|version|time|userinfo|clientinfo} Does the given ctcp request on

nickname.

/closemsg {nickname} Closes the query window you have open to the specified nick.

/creq [ask | auto | ignore] Sets your DCC ‘On Chat request’ settings in DCC/Options.

/dcc send {nickname} {file1} {file2} {file3} … {fileN} Sends the specified files to nick.

/dcc chat {nickname} Opens a dcc window and sends a dcc chat request to nickname.

/describe {#channel} {action text} Sends the specifed action to the specified channel window.

/dde [-r] {service} {topic} {item} [data] Allows DDE control between mIRC and other

applications.

/ddeserver [on [service name] | off] To turn on the DDE server mode, eventually with a given

service name.

/disable {#groupname} De-activates a group of commands or events.

/disconnect Forces a hard and immediate disconnect from your IRC server. Use it with care.

/dlevel {level} Changes the default user level in the remote section.

/dns {nickname | IP address | IP name} Uses your providers DNS to resolve an IP address.

/echo [nickname|#channel|status] {text} Displays the given text only to YOU on the given place

in color N.

/enable {#groupname} Activates a group of commands or events.

/events [on|off] Shows the remote events status or sets it to listening or not.

/exit Forces mIRC to closedown and exit.

/finger Does a finger on a users address.

/flood [{numberoflines} {seconds} {pausetime}] Sets a crude flood control method.

/fsend [on|off] Shows fsends status and allows you to turn dcc fast send on or off.

/fserve {nickname} {maxgets} {homedirectory} [welcome text file] Opens a fileserver.

/guser {level} {nick} [type] Adds the user to the user list with the specified level and

address type.

/help {keyword} Brings up the Basic IRC Commands section in the mIRC help file.

/ignore [on|off|nickname|address] Toggles ignoring of a nick or address or sets it on or off

totally.

/invite {nickname} {#channel} Invites another user to a channel.

/join {#channel} Makes you join the specified channel.

/kick {#channel} {nickname} Kicks nickname off a given channel.

/list [#string] [-min #] [-max #] Lists all currently available channels, evt. filtering for

parameters.

/log [on|off] Shows the logging status or sets it on or off for the current window.

/me {action text} Sends the specifed action to the active channel or query window.

/mode {#channel|nickname} [[+|-]modechars [parameters]] Sets channel or user modes.

/msg {nickname} {message} Send a private message to this user without opening a query window.

/names {#channel} Shows the nicks of all people on the given channel.

/nick {new nickname} Changes your nickname to whatever you like.

/notice {nick} {message} Send the specified notice message to the nick.

/notify [on|off|nickname] Toggles notifying you of a nick on IRC or sets it on or off totally.

/onotice [#channel] {message} Send the specified notice message to all channel ops.

/omsg [#channel] {message} Send the specified message to all ops on a channel.

/part {#channel} Makes you leave the specified channel.

/partall Makes you leave all channels you are on.

/ping {server address} Pings the given server. NOT a nickname.

/play [-c] {filename} [delay] Allows you to send text files to a window.

/pop {delay} [#channel] {nickname} Performs a randomly delayed +o on a not already opped nick.

/protect [on|off|nickname|address] Toggles protection of a nick or address or sets it on or off

totally.

/query {nickname} {message} Open a query window to this user and send them the private message.

/quit [reason] Disconnect you from IRC with the optional byebye message.

/raw {raw command} Sends any raw command you supply directly to the server. Use it with care!!

/remote [on|off] Shows the remote commands status or sets it to listening or not.

/rlevel {access level} Removes all users from the remote users list with the specified access

level.

/run {c:\path\program.exe} [parameters] Runs the specified program, evt. with parameters.

/ruser {nick[!]|address} [type] Removes the user from the remote users list.

/save {filename.ini} Saves remote sections into a specified INI file.

/say {text} Says whatever you want to the active window.

/server [server address [port] [password]] Reconnects to the previous server or a newly

specified one.

/sound [nickname|#channel] {filename.wav} {action text} Sends an action and a fitting sound.

/speak {text} Uses the external text to speech program Monologue to speak up the text.

/sreq [ask | auto | ignore] Sets your DCC ‘On Send request’ settings in DCC/Options.

/time Tells you the time on the server you use.

/timer[N] {repetitions} {interval in seconds} {command} [| {more commands}] Activates a timer.

/topic {#channel} {newtopic} Changes the topic for the specified channel.

/ulist [{|}]{level} Lists all users in the remote list with the specified access levels.

/url [-d] Opens the URL windows that allows you to surf the www parallel to IRC.

/uwho [nick] Pops up the user central with information about the specified user.

/who {#channel} Shows the nicks of all people on the given channel.

/who {*address.string*} Shows all people on IRC with a matching address.

/whois {nickname} Shows information about someone in the status window.

/whowas {nickname} Shows information about someone who -just- left IRC.

/wavplay {c:\path\sound.wav} Locally plays the specified wave file.

/write [-cidl] {filename} [text] To write the specified text to a .txt file.

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)