7

The certutil utiliiy in Windows can be used to perform Base64 encoding and deocding. Is there any built-in utility for URL encoding and decoding? There are many free tools available on web. But I am specifically looking for Windows built-in utility or if not simple script that can run on Windows.

Thanks!

Sambhaji
  • 990
  • 5
  • 19
  • 31
  • 1
    Encoding/decoding between a URL and Base64 or do you mean things like `InternetCanonicalizeUrl` and `UrlEscape` – ta.speot.is Dec 24 '15 at 05:40
  • I meant encoding certain characters in a URL by replacing them with one or more character triplets that consist of the percent character "%" followed by two hexadecimal digits. – Sambhaji Dec 24 '15 at 05:45
  • http://sourceforge.net/projects/gbm64/ for base64 encode/decode; http://sourceforge.net/projects/urlexam/ for url encode/decode – zedfoxus Dec 24 '15 at 05:45
  • @zedfoxus, I cannot "download" any external tool in my office. – Sambhaji Dec 24 '15 at 05:46

2 Answers2

14

Base64 VBA

Base64 encoding and decoding can be done with VBA. You can copy/paste this code and put it in Excel VBA, for example, and then use it's methods to encode and decode Base64.

URL encode/decode VBA

How can I URL encode a string in Excel VBA? and Does VBA have any built in URL decoding? is a URL decoder. Using these tools you should be able to encode and decode within Windows environment with MS Office products such as Excel and VBA.

Base64 PowerShell

If you use powershell, check this out: http://vstepic.blogspot.com/2013/02/how-to-convert-string-to-base64-and.html. Excerpt from that site:

PS C:\Temp>$b  = [System.Text.Encoding]::UTF8.GetBytes("Hello World")
PS C:\Temp>[System.Convert]::ToBase64String($b)
SGVsbG8gV29ybGQ=

PS C:\Temp>$b  = [System.Convert]::FromBase64String("SGVsbG8gV29ybGQ=")
PS C:\Temp>[System.Text.Encoding]::UTF8.GetString($b)
Hello World

URL encode/decode PowerShell

For URL encode/decode you could use:

[Reflection.Assembly]::LoadWithPartialName("System.Web") | Out-Null
[System.Web.HttpUtility]::UrlEncode("http://test.com/?path=what is")
http%3a%2f%2ftest.com%2f%3fpath%3dwhat+is

[System.Web.HttpUtility]::UrlDecode("http%3a%2f%2ftest.com%2f%3fpath%3dwhat+is")
http://test.com/?path=what is

Reference: https://gallery.technet.microsoft.com/scriptcenter/Encoding-and-Decoding-URL-99dc4256

Community
  • 1
  • 1
zedfoxus
  • 35,121
  • 5
  • 64
  • 63
1

For me [System.Net.WebUtility] worked instead of [System.Web.HttpUtility]

Suraj Rao
  • 29,388
  • 11
  • 94
  • 103
rap
  • 11
  • 1