小编C S*_*ner的帖子

PowerShell - 将FileTime转换为HexString

在搜索了interwebs之后,我设法创建了一个C#类来获取FileTimeUTC Hex String.

public class HexHelper
{
    public static string GetUTCFileTimeAsHexString()
    {
        string sHEX = "";

        long ftLong = DateTime.Now.ToFileTimeUtc();
        int ftHigh = (int)(ftLong >> 32);
        int ftLow = (int)ftLong;
        sHEX = ftHigh.ToString("X") + ":" + ftLow.ToString("X");

        return sHEX;
    }
}
Run Code Online (Sandbox Code Playgroud)

对于PowerShell,我尝试使用相同的代码:

$HH = @"
public class HexHelper
{
    public static string GetUTCFileTimeAsHexString()
    {
        string sHEX = "";

        long ftLong = DateTime.Now.ToFileTimeUtc();
        int ftHigh = (int)(ftLong >> 32);
        int ftLow = (int)ftLong;
        sHEX = ftHigh.ToString("X") + ":" + ftLow.ToString("X");

        return …
Run Code Online (Sandbox Code Playgroud)

c# string powershell hex filetime

7
推荐指数
2
解决办法
101
查看次数

标签 统计

c# ×1

filetime ×1

hex ×1

powershell ×1

string ×1