问题
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!
回答1:
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
回答2:
For me [System.Net.WebUtility]
worked instead of [System.Web.HttpUtility]
来源:https://stackoverflow.com/questions/34447793/does-windows-have-any-built-in-utility-to-encode-decode-url