Generate “file://” URIs in Windows ExplorerShorter shortcuts for explorer context menu entries?How to map...

Languages that we cannot (dis)prove to be Context-Free

How much RAM could one put in a typical 80386 setup?

Theorems that impeded progress

Approximately how much travel time was saved by the opening of the Suez Canal in 1869?

tikz: show 0 at the axis origin

Modeling an IPv4 Address

"to be prejudice towards/against someone" vs "to be prejudiced against/towards someone"

Do I have a twin with permutated remainders?

Why do falling prices hurt debtors?

Smoothness of finite-dimensional functional calculus

How does strength of boric acid solution increase in presence of salicylic acid?

Is this a crack on the carbon frame?

What's the output of a record cartridge playing an out-of-speed record

What would happen to a modern skyscraper if it rains micro blackholes?

Has the BBC provided arguments for saying Brexit being cancelled is unlikely?

How old can references or sources in a thesis be?

Is it tax fraud for an individual to declare non-taxable revenue as taxable income? (US tax laws)

How to format long polynomial?

I’m planning on buying a laser printer but concerned about the life cycle of toner in the machine

Which models of the Boeing 737 are still in production?

What are these boxed doors outside store fronts in New York?

What is the word for reserving something for yourself before others do?

Collect Fourier series terms

Accidentally leaked the solution to an assignment, what to do now? (I'm the prof)



Generate “file://” URIs in Windows Explorer


Shorter shortcuts for explorer context menu entries?How to map a key to a file explorer shell extension?How can I copy a file's path to the clipboard from Windows 7's Explorer?Add Windows Explorer context menu item for SASS --watch option?How to copy Windows Explorer file selections and paste filenames as textOpen Powershell in ConEmu from context windowCan someone clarify how the windows file system works?AutoHotKey: copy file from Windows Explorer, paste path to Notepad2CTRL+C on a file/folder, how to get the filename in a batch? (read clipboard filenames from batch)Print a list of selected file names in Windows 10






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







4

















I am searching for a way to obtain a proper file:/ URI from inside Windows Explorer. Basically I would like to have a context menu entry which says "copy file URI to clipboard". Does something like that exist?



This is not a duplicate of "Copy filename to clipboard" since I want a file URI and not the path name.



To clarify: I am looking to get "file:///c:/Temp/foo%20bar.txt" and neither "C:Tempfoo bar.txt" nor "foo bar.txt" nor "C:Temp".










share|improve this question















migrated from stackoverflow.com Jun 14 '11 at 15:15


This question came from our site for professional and enthusiast programmers.



















  • Thanks! One of the responses mentions FileMenu Tools which has that functionality but it retains spaces in the copied string which makes it an invalid URI. :-(

    – Robert Klemme
    Jun 14 '11 at 16:02













  • This is not a duplicate of "Copy filename to clipboard" since I want a file URI and not the path name.

    – Robert Klemme
    Jun 15 '11 at 14:51











  • To clarify: I am looking to get "file:///c:/Temp/foo%20bar.txt" and neither "C:Tempfoo bar.txt" nor "foo bar.txt" nor "C:Temp".

    – Robert Klemme
    Jun 16 '11 at 8:09


















4

















I am searching for a way to obtain a proper file:/ URI from inside Windows Explorer. Basically I would like to have a context menu entry which says "copy file URI to clipboard". Does something like that exist?



This is not a duplicate of "Copy filename to clipboard" since I want a file URI and not the path name.



To clarify: I am looking to get "file:///c:/Temp/foo%20bar.txt" and neither "C:Tempfoo bar.txt" nor "foo bar.txt" nor "C:Temp".










share|improve this question















migrated from stackoverflow.com Jun 14 '11 at 15:15


This question came from our site for professional and enthusiast programmers.



















  • Thanks! One of the responses mentions FileMenu Tools which has that functionality but it retains spaces in the copied string which makes it an invalid URI. :-(

    – Robert Klemme
    Jun 14 '11 at 16:02













  • This is not a duplicate of "Copy filename to clipboard" since I want a file URI and not the path name.

    – Robert Klemme
    Jun 15 '11 at 14:51











  • To clarify: I am looking to get "file:///c:/Temp/foo%20bar.txt" and neither "C:Tempfoo bar.txt" nor "foo bar.txt" nor "C:Temp".

    – Robert Klemme
    Jun 16 '11 at 8:09














4












4








4










I am searching for a way to obtain a proper file:/ URI from inside Windows Explorer. Basically I would like to have a context menu entry which says "copy file URI to clipboard". Does something like that exist?



This is not a duplicate of "Copy filename to clipboard" since I want a file URI and not the path name.



To clarify: I am looking to get "file:///c:/Temp/foo%20bar.txt" and neither "C:Tempfoo bar.txt" nor "foo bar.txt" nor "C:Temp".










share|improve this question


















I am searching for a way to obtain a proper file:/ URI from inside Windows Explorer. Basically I would like to have a context menu entry which says "copy file URI to clipboard". Does something like that exist?



This is not a duplicate of "Copy filename to clipboard" since I want a file URI and not the path name.



To clarify: I am looking to get "file:///c:/Temp/foo%20bar.txt" and neither "C:Tempfoo bar.txt" nor "foo bar.txt" nor "C:Temp".







windows windows-explorer uri






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 24 '16 at 15:25









Ƭᴇcʜιᴇ007

100k14158221




100k14158221










asked Jun 14 '11 at 13:54









Robert KlemmeRobert Klemme

1214




1214




migrated from stackoverflow.com Jun 14 '11 at 15:15


This question came from our site for professional and enthusiast programmers.









migrated from stackoverflow.com Jun 14 '11 at 15:15


This question came from our site for professional and enthusiast programmers.















  • Thanks! One of the responses mentions FileMenu Tools which has that functionality but it retains spaces in the copied string which makes it an invalid URI. :-(

    – Robert Klemme
    Jun 14 '11 at 16:02













  • This is not a duplicate of "Copy filename to clipboard" since I want a file URI and not the path name.

    – Robert Klemme
    Jun 15 '11 at 14:51











  • To clarify: I am looking to get "file:///c:/Temp/foo%20bar.txt" and neither "C:Tempfoo bar.txt" nor "foo bar.txt" nor "C:Temp".

    – Robert Klemme
    Jun 16 '11 at 8:09



















  • Thanks! One of the responses mentions FileMenu Tools which has that functionality but it retains spaces in the copied string which makes it an invalid URI. :-(

    – Robert Klemme
    Jun 14 '11 at 16:02













  • This is not a duplicate of "Copy filename to clipboard" since I want a file URI and not the path name.

    – Robert Klemme
    Jun 15 '11 at 14:51











  • To clarify: I am looking to get "file:///c:/Temp/foo%20bar.txt" and neither "C:Tempfoo bar.txt" nor "foo bar.txt" nor "C:Temp".

    – Robert Klemme
    Jun 16 '11 at 8:09

















Thanks! One of the responses mentions FileMenu Tools which has that functionality but it retains spaces in the copied string which makes it an invalid URI. :-(

– Robert Klemme
Jun 14 '11 at 16:02







Thanks! One of the responses mentions FileMenu Tools which has that functionality but it retains spaces in the copied string which makes it an invalid URI. :-(

– Robert Klemme
Jun 14 '11 at 16:02















This is not a duplicate of "Copy filename to clipboard" since I want a file URI and not the path name.

– Robert Klemme
Jun 15 '11 at 14:51





This is not a duplicate of "Copy filename to clipboard" since I want a file URI and not the path name.

– Robert Klemme
Jun 15 '11 at 14:51













To clarify: I am looking to get "file:///c:/Temp/foo%20bar.txt" and neither "C:Tempfoo bar.txt" nor "foo bar.txt" nor "C:Temp".

– Robert Klemme
Jun 16 '11 at 8:09





To clarify: I am looking to get "file:///c:/Temp/foo%20bar.txt" and neither "C:Tempfoo bar.txt" nor "foo bar.txt" nor "C:Temp".

– Robert Klemme
Jun 16 '11 at 8:09










2 Answers
2






active

oldest

votes


















3














Just came up with this VBS.



If WScript.arguments.count > 0 Then
Dim WshShell: Set WshShell = WScript.CreateObject("Wscript.Shell")
strPath = "file:///" & Wscript.Arguments(0)
strPath = Replace(strPath,"","/")
strPath = Replace(strPath," ","%20")
sCmd = "%comspec% /c<nul (set/p anyvariable=" & Chr(34) & strPath & Chr(34) & ")|clip.exe"
WshShell.Run sCmd,0,0
Set WshShell = Nothing
End If


Save it as a .VBS file. Drag and drop a file on to the VBScript and it copies the file's URI to clipboard. You can implement it in the right-click menu if required.



It copies the file name to memory, reverses the slashes, replaces spaces with "%20", and appends "file:///" at the beginning. It's a basic script which supports only one file name / argument. You can modify it as required.



Add the Script to your Send To folder



You may place a shortcut of the script in your Send To folder. Press WinKey + R, type shell:sendto and press ENTER. Create a shortcut to the script in the Send To folder and name it accordingly. (eg. Copy File URI)



Now, right-click a file, click Send To and click Copy File URI. The file path would be copied to the clipboard, in the URI format as below.



file:///C:/Users/jack/desktop/list-of-items.txt





share|improve this answer

































    0














    The VBS script is nice, but there is no way it handles all the edge cases handled by the likes of UrlCreateFromPath or .NET's System.URI.



    Fortunately, both are easy to use, here's what I did:



    using System;
    using System.Windows.Forms;

    namespace AbsoluteUriGenerator
    {
    class Program
    {
    [STAThread]
    static int Main(string[] args)
    {
    if (args.Length != 1)
    {
    var executableName = typeof(Program).Assembly.GetName().Name + ".exe";
    Console.WriteLine("Usage: {0} pathToConvert", executableName);
    Console.WriteLine("Example: {0} "C:\foo"", executableName);
    return 1;
    }

    var path = args[0];
    Console.WriteLine("Resolving file:// URI of path: {0}", path);
    var fileUri = new Uri(path).AbsoluteUri;

    Console.WriteLine("Setting clipboard to resolved file:// URI: {0}", fileUri);
    Clipboard.SetText(fileUri);
    return 0;
    }
    }
    }


    You can copy it to your shell:sendto folder, here's a compiled version: https://1drv.ms/u/s!Aj2cMNVj29ben4B_mh9Md5R4ghBlMQ






    share|improve this answer
























      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "3"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f297060%2fgenerate-file-uris-in-windows-explorer%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      3














      Just came up with this VBS.



      If WScript.arguments.count > 0 Then
      Dim WshShell: Set WshShell = WScript.CreateObject("Wscript.Shell")
      strPath = "file:///" & Wscript.Arguments(0)
      strPath = Replace(strPath,"","/")
      strPath = Replace(strPath," ","%20")
      sCmd = "%comspec% /c<nul (set/p anyvariable=" & Chr(34) & strPath & Chr(34) & ")|clip.exe"
      WshShell.Run sCmd,0,0
      Set WshShell = Nothing
      End If


      Save it as a .VBS file. Drag and drop a file on to the VBScript and it copies the file's URI to clipboard. You can implement it in the right-click menu if required.



      It copies the file name to memory, reverses the slashes, replaces spaces with "%20", and appends "file:///" at the beginning. It's a basic script which supports only one file name / argument. You can modify it as required.



      Add the Script to your Send To folder



      You may place a shortcut of the script in your Send To folder. Press WinKey + R, type shell:sendto and press ENTER. Create a shortcut to the script in the Send To folder and name it accordingly. (eg. Copy File URI)



      Now, right-click a file, click Send To and click Copy File URI. The file path would be copied to the clipboard, in the URI format as below.



      file:///C:/Users/jack/desktop/list-of-items.txt





      share|improve this answer






























        3














        Just came up with this VBS.



        If WScript.arguments.count > 0 Then
        Dim WshShell: Set WshShell = WScript.CreateObject("Wscript.Shell")
        strPath = "file:///" & Wscript.Arguments(0)
        strPath = Replace(strPath,"","/")
        strPath = Replace(strPath," ","%20")
        sCmd = "%comspec% /c<nul (set/p anyvariable=" & Chr(34) & strPath & Chr(34) & ")|clip.exe"
        WshShell.Run sCmd,0,0
        Set WshShell = Nothing
        End If


        Save it as a .VBS file. Drag and drop a file on to the VBScript and it copies the file's URI to clipboard. You can implement it in the right-click menu if required.



        It copies the file name to memory, reverses the slashes, replaces spaces with "%20", and appends "file:///" at the beginning. It's a basic script which supports only one file name / argument. You can modify it as required.



        Add the Script to your Send To folder



        You may place a shortcut of the script in your Send To folder. Press WinKey + R, type shell:sendto and press ENTER. Create a shortcut to the script in the Send To folder and name it accordingly. (eg. Copy File URI)



        Now, right-click a file, click Send To and click Copy File URI. The file path would be copied to the clipboard, in the URI format as below.



        file:///C:/Users/jack/desktop/list-of-items.txt





        share|improve this answer




























          3












          3








          3







          Just came up with this VBS.



          If WScript.arguments.count > 0 Then
          Dim WshShell: Set WshShell = WScript.CreateObject("Wscript.Shell")
          strPath = "file:///" & Wscript.Arguments(0)
          strPath = Replace(strPath,"","/")
          strPath = Replace(strPath," ","%20")
          sCmd = "%comspec% /c<nul (set/p anyvariable=" & Chr(34) & strPath & Chr(34) & ")|clip.exe"
          WshShell.Run sCmd,0,0
          Set WshShell = Nothing
          End If


          Save it as a .VBS file. Drag and drop a file on to the VBScript and it copies the file's URI to clipboard. You can implement it in the right-click menu if required.



          It copies the file name to memory, reverses the slashes, replaces spaces with "%20", and appends "file:///" at the beginning. It's a basic script which supports only one file name / argument. You can modify it as required.



          Add the Script to your Send To folder



          You may place a shortcut of the script in your Send To folder. Press WinKey + R, type shell:sendto and press ENTER. Create a shortcut to the script in the Send To folder and name it accordingly. (eg. Copy File URI)



          Now, right-click a file, click Send To and click Copy File URI. The file path would be copied to the clipboard, in the URI format as below.



          file:///C:/Users/jack/desktop/list-of-items.txt





          share|improve this answer















          Just came up with this VBS.



          If WScript.arguments.count > 0 Then
          Dim WshShell: Set WshShell = WScript.CreateObject("Wscript.Shell")
          strPath = "file:///" & Wscript.Arguments(0)
          strPath = Replace(strPath,"","/")
          strPath = Replace(strPath," ","%20")
          sCmd = "%comspec% /c<nul (set/p anyvariable=" & Chr(34) & strPath & Chr(34) & ")|clip.exe"
          WshShell.Run sCmd,0,0
          Set WshShell = Nothing
          End If


          Save it as a .VBS file. Drag and drop a file on to the VBScript and it copies the file's URI to clipboard. You can implement it in the right-click menu if required.



          It copies the file name to memory, reverses the slashes, replaces spaces with "%20", and appends "file:///" at the beginning. It's a basic script which supports only one file name / argument. You can modify it as required.



          Add the Script to your Send To folder



          You may place a shortcut of the script in your Send To folder. Press WinKey + R, type shell:sendto and press ENTER. Create a shortcut to the script in the Send To folder and name it accordingly. (eg. Copy File URI)



          Now, right-click a file, click Send To and click Copy File URI. The file path would be copied to the clipboard, in the URI format as below.



          file:///C:/Users/jack/desktop/list-of-items.txt






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Aug 24 '16 at 15:26

























          answered Jul 12 '16 at 15:19









          Win32GuyWin32Guy

          7,49622434




          7,49622434

























              0














              The VBS script is nice, but there is no way it handles all the edge cases handled by the likes of UrlCreateFromPath or .NET's System.URI.



              Fortunately, both are easy to use, here's what I did:



              using System;
              using System.Windows.Forms;

              namespace AbsoluteUriGenerator
              {
              class Program
              {
              [STAThread]
              static int Main(string[] args)
              {
              if (args.Length != 1)
              {
              var executableName = typeof(Program).Assembly.GetName().Name + ".exe";
              Console.WriteLine("Usage: {0} pathToConvert", executableName);
              Console.WriteLine("Example: {0} "C:\foo"", executableName);
              return 1;
              }

              var path = args[0];
              Console.WriteLine("Resolving file:// URI of path: {0}", path);
              var fileUri = new Uri(path).AbsoluteUri;

              Console.WriteLine("Setting clipboard to resolved file:// URI: {0}", fileUri);
              Clipboard.SetText(fileUri);
              return 0;
              }
              }
              }


              You can copy it to your shell:sendto folder, here's a compiled version: https://1drv.ms/u/s!Aj2cMNVj29ben4B_mh9Md5R4ghBlMQ






              share|improve this answer




























                0














                The VBS script is nice, but there is no way it handles all the edge cases handled by the likes of UrlCreateFromPath or .NET's System.URI.



                Fortunately, both are easy to use, here's what I did:



                using System;
                using System.Windows.Forms;

                namespace AbsoluteUriGenerator
                {
                class Program
                {
                [STAThread]
                static int Main(string[] args)
                {
                if (args.Length != 1)
                {
                var executableName = typeof(Program).Assembly.GetName().Name + ".exe";
                Console.WriteLine("Usage: {0} pathToConvert", executableName);
                Console.WriteLine("Example: {0} "C:\foo"", executableName);
                return 1;
                }

                var path = args[0];
                Console.WriteLine("Resolving file:// URI of path: {0}", path);
                var fileUri = new Uri(path).AbsoluteUri;

                Console.WriteLine("Setting clipboard to resolved file:// URI: {0}", fileUri);
                Clipboard.SetText(fileUri);
                return 0;
                }
                }
                }


                You can copy it to your shell:sendto folder, here's a compiled version: https://1drv.ms/u/s!Aj2cMNVj29ben4B_mh9Md5R4ghBlMQ






                share|improve this answer


























                  0












                  0








                  0







                  The VBS script is nice, but there is no way it handles all the edge cases handled by the likes of UrlCreateFromPath or .NET's System.URI.



                  Fortunately, both are easy to use, here's what I did:



                  using System;
                  using System.Windows.Forms;

                  namespace AbsoluteUriGenerator
                  {
                  class Program
                  {
                  [STAThread]
                  static int Main(string[] args)
                  {
                  if (args.Length != 1)
                  {
                  var executableName = typeof(Program).Assembly.GetName().Name + ".exe";
                  Console.WriteLine("Usage: {0} pathToConvert", executableName);
                  Console.WriteLine("Example: {0} "C:\foo"", executableName);
                  return 1;
                  }

                  var path = args[0];
                  Console.WriteLine("Resolving file:// URI of path: {0}", path);
                  var fileUri = new Uri(path).AbsoluteUri;

                  Console.WriteLine("Setting clipboard to resolved file:// URI: {0}", fileUri);
                  Clipboard.SetText(fileUri);
                  return 0;
                  }
                  }
                  }


                  You can copy it to your shell:sendto folder, here's a compiled version: https://1drv.ms/u/s!Aj2cMNVj29ben4B_mh9Md5R4ghBlMQ






                  share|improve this answer













                  The VBS script is nice, but there is no way it handles all the edge cases handled by the likes of UrlCreateFromPath or .NET's System.URI.



                  Fortunately, both are easy to use, here's what I did:



                  using System;
                  using System.Windows.Forms;

                  namespace AbsoluteUriGenerator
                  {
                  class Program
                  {
                  [STAThread]
                  static int Main(string[] args)
                  {
                  if (args.Length != 1)
                  {
                  var executableName = typeof(Program).Assembly.GetName().Name + ".exe";
                  Console.WriteLine("Usage: {0} pathToConvert", executableName);
                  Console.WriteLine("Example: {0} "C:\foo"", executableName);
                  return 1;
                  }

                  var path = args[0];
                  Console.WriteLine("Resolving file:// URI of path: {0}", path);
                  var fileUri = new Uri(path).AbsoluteUri;

                  Console.WriteLine("Setting clipboard to resolved file:// URI: {0}", fileUri);
                  Clipboard.SetText(fileUri);
                  return 0;
                  }
                  }
                  }


                  You can copy it to your shell:sendto folder, here's a compiled version: https://1drv.ms/u/s!Aj2cMNVj29ben4B_mh9Md5R4ghBlMQ







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered yesterday









                  Ohad SchneiderOhad Schneider

                  407612




                  407612






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Super User!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f297060%2fgenerate-file-uris-in-windows-explorer%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      VNC viewer RFB protocol error: bad desktop size 0x0I Cannot Type the Key 'd' (lowercase) in VNC Viewer...

                      Tribunal Administrativo e Fiscal de Mirandela Referências Menu de...

                      looking for continuous Screen Capture for retroactivly reproducing errors, timeback machineRolling desktop...