diff --git a/commands/core/variable.drush.inc b/commands/core/variable.drush.inc
index c199ba2..fab7d99 100644
--- a/commands/core/variable.drush.inc
+++ b/commands/core/variable.drush.inc
@@ -39,13 +39,12 @@ function variable_drush_command() {
     'options' => array(
       'yes' => 'Skip confirmation if only one variable name matches.',
       'always-set' => 'Always skip confirmation.',
-      'format' => 'Format to parse the object. Use "string" for string (default), and "json" for JSON.',
+      'format' => 'Format to parse the object. Use "auto" to detect format from value (default), "string", "integer" or "boolean" for corresponding primitive type, and "json" for JSON.',
     ),
     'examples' => array(
-      'drush vset --yes preprocess_css 1' => 'Set the preprocess_css variable to true. Skip confirmation if variable already exists.',
-      'drush vset --always-set site_offline 1' => 'Take the site offline; Skips confirmation even if site_offline variable does not exist.',
-      'drush vset pr 1' => 'Choose from a list of variables beginning with "pr" to set to true.',
-      'php -r "print json_encode(TRUE);" | drush vset --format=json foo -' => 'Set foo to a boolean value',
+      'drush vset --yes preprocess_css TRUE' => 'Set the preprocess_css variable to true. Skip confirmation if variable already exists.',
+      'drush vset --always-set site_offline TRUE' => 'Take the site offline; Skips confirmation even if site_offline variable does not exist.',
+      'drush vset pr TRUE' => 'Choose from a list of variables beginning with "pr" to set to true.',
       'php -r "print json_encode(array(\'drupal\', \'simpletest\'));"  | drush vset --format=json project_dependency_excluded_dependencies -'=> 'Set a variable to a complex value (e.g. array)',
     ),
     'aliases' => array('vset'),
@@ -160,21 +159,57 @@ function drush_variable_set() {
     $value = stream_get_contents(STDIN);
   }
 
+  $format = drush_get_option('format', 'auto');
+  if ($format == 'auto') {
+    if (is_numeric($value)) {
+      $format = 'integer';
+    }
+    elseif (($value == 'TRUE') || ($value == 'FALSE')) {
+      $format = 'bool';
+    }
+  }
+
   // Now, we parse the object.
-  switch (drush_get_option('format', 'string')) {
+  switch ($format) {
+    case 'integer':
+      $value = (integer)$value;
+      break;
+    
+    case 'bool':
+    case 'boolean':
+      if ($value == 'TRUE') {
+        $value = TRUE;
+      }
+      elseif ($value == 'FALSE') {
+        $value = FALSE;
+      }
+      else {
+        $value = (bool)$value;
+      }
+      break;
+
     case 'json':
       $value = drush_json_decode($value);
       break;
   }
 
+  // Format the output
+  if (is_array($value)) {
+    $display = "\n" . var_export($value, TRUE);
+  }
+  elseif (is_integer($value)) {
+    $display = $value;
+  }
+  elseif (is_bool($value)) {
+    $display = $value ? "TRUE" : "FALSE";
+  }
+  else {
+    $display = '"' . $value . '"';
+  }
+  
   if (drush_get_option('always-set', FALSE) || count($options) == 1 || $match) {
     variable_set($args[0], $value);
-    if (is_scalar($value)) {
-      drush_log(dt('!name was set to !value.', array('!name' => $args[0], '!value' => $value)), 'success');
-    }
-    else {
-      drush_log(dt('!name was set.', array('!name' => $args[0])), 'success');
-    }
+    drush_log(dt('!name was set to !value.', array('!name' => $args[0], '!value' => $display)), 'success');
     return '';
   }
   else {
@@ -183,7 +218,7 @@ function drush_variable_set() {
       $choice = $options[$choice];
       $choice = str_replace(' ' . dt('(new variable)'), '', $choice);
       drush_op('variable_set', $choice, $value);
-      drush_log(dt('!name was set to !value', array('!name' => $choice, '!value' => $value)), 'success');
+      drush_log(dt('!name was set to !value', array('!name' => $choice, '!value' => $display)), 'success');
     }
   }
 }
