Tag Archives: windows

Microsoft Windows XP – Runas commandline example

   
I have come across this great command ‘runas’ in windows . Its just cool
It allows us to run programs with different permissions than the one that we currently logged on provides. It is similar sudo command in unix ( if you’re a UNIX lover, you would know :-) )

	Syntax:

	  Just runas/? in windows command prompt. It will show the synax and explains all the parameters required.

	C:\codedairy>runas/?
	RUNAS USAGE:

	RUNAS [ [/noprofile | /profile] [/env] [/netonly] ]
		/user: program

	RUNAS [ [/noprofile | /profile] [/env] [/netonly] ]
		/smartcard [/user:] program

	   /noprofile        specifies that the user's profile should not be loaded.
			     This causes the application to load more quickly, but
			     can cause some applications to malfunction.
	   /profile          specifies that the user's profile should be loaded.
			     This is the default.
	   /env              to use current environment instead of user's.
	   /netonly          use if the credentials specified are for remote
			     access only.
	   /savecred         to use credentials previously saved by the user.
			     This option is not available on Windows XP Home Edition
			     and will be ignored.
	   /smartcard        use if the credentials are to be supplied from a
			     smartcard.
	   /user              should be in form USER@DOMAIN or DOMAIN\USER
	   program         command line for EXE.  See below for examples

	Examples:
	> runas /noprofile /user:mymachine\administrator cmd
	> runas /profile /env /user:mydomain\admin "mmc %windir%\system32\dsa.msc"
	> runas /env /user:user@domain.microsoft.com "notepad \"my file.txt\""

	NOTE:  Enter user's password only when prompted.
	NOTE:  USER@DOMAIN is not compatible with /netonly.
	NOTE:  /profile is not compatible with /netonly.

Example:

Let’s say we want to run an internet explorer with a different user.


C:\codedairy>

C:\codedairy>runas /user:GLOBAL\usr1 "c:\Program Files\Internet Explorer\iexplore.exe"
Enter the password for GLOBAL\usr1: XXXXXX
Attempting to start c:\Program Files\Internet Explorer\iexplore.exe as user "GLOBAL\usr1" ...

C:\codedairy\usr1>

Use the Run As command by using a shortcut

  1. Click on Start menu – Go to Programs, and then find the shortcut item in the Programs menu.
  2. If the shortcut is not located in the Programs folder of the Start menu, browse to the correct location of the shortcut.
  3. Press SHIFT and hold while you right-click the shortcut item and then click Run as.
  4. In Run As, select the User name and type the Password, and then click OK.
  5. That’s it. Job done !
  6. Thanks for reading my post. please do not hesitate to post your comments or ask any questions below ( or even you find any mistakes too :-) )


Microsoft Excel If and Nested If function examples

In this short tutorial, I explain how to use If function and Nested If function in Microsoft Excel with an example

It is very easy to implement If THEN ELSE logic in Microsoft Excel

Let’s take a look in detail. Let us see the syntax first

Simple If Syntax function

IF( condition1, value_if_true1,value_if_false1 )

This is equivalent to saying….

IF condition1 THEN
        value_if_true1
    ELSE
        value_if_false1

Nested If Syntax function

IF( condition1, value_if_true1, IF( condition2, value_if_true2, value_if_false2 ))

This syntax is equivalent to…

IF condition1 THEN
        value_if_true1
    ELSEIF condition2 THEN
        value_if_true2
    ELSE
        value_if_false2
    END IF

Now, Let’s take closure look into an example

Please pay an attention to the above figure- showing If, Nested If functions

Q1: This column using a simple If

Requirement: display “A” for Customers whose Ids are less than 200 Otherwise display “B” in the Q1 column

We write below a simple if to fulfill this requirement

IF( A2 < 200, "A","B")

Please refer to the Q1 column in the above figure on the output of this function

Q2: This column using a Nested If

Requirement:

if ( Customer IDs < 200 ) then
   return "A"
 else if ( Total Points > 100 ) then
   return "A"
 else
   return "B"

We write below a Nested if to fulfill this requirement

IF( A2 < 200, "A",IF ( D2 > 100, "A","B") )

Please refer to the Q2 column in the above figure on the output of this function

How do we write If ( A > 10 and B > 20 )?

Yes. In Microsoft excel, you could do multiple conditions in If. You use the keywords ‘AND’, ‘OR’ in IF block to add more conditional statements.

AND : Used in the cases where more than one condition should get satisfied to execute the true block otherwise it will execute false block
OR : Used where at least one condition statement should to get satisfied to execute the true block otherwise it’ll execute the false block

Q3: ‘AND’ Keyword in IF block, example

Requirement: Display “Eligible” for the customers whose points are > 50 and their order price is greater than 100. i.e.,

If (Total points > 50 and Price > 100 ) then
             display "Eligible"
        else 
             display "Not Eligible"
  

IF ( AND ( D2 > 50, C2 > 100 ), "Eligible", "Not Eligible" )

Please refer to the Q3 column in the above figure on the output of this function

That’s it. We’ve reached the end of the tutorial on ‘How to use If and Nested If functions in Microsoft Excel’

Do what you love! But To be a Techy, do more reading