Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共2 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:将字体文件安装到系统,代码如何写?

1楼
kgdce 发表于:2024/6/11 19:35:00
If filesys.FileExists("C:\Windows\ Fonts\HYT_OMR_Jx.ttf") Then
    Output.Show("1")
Else
    Dim fstr As String = projectpath & "Attachments\HYT_OMR_Jx.ttf"
    Dim f As String = SpecialFolder.SYSTEM
    f = f.Substring(0, f.LastIndexOf("\")) & "\Fonts\HYT_OMR_Jx.ttf" 
    Dim fcmd As String = projectpath & "Attachments\test.bat" 
    FileSys.WriteAllText(fcmd, "copy " & fstr & " " & f & " /y", False, encoding.default)
    'FileSys.WriteAllText(fcmd, "copy " & fstr & " " & f & " /y" & vbcrlf & "pause", False, encoding.default)
    System.Diagnostics.Process.Start("Explorer", "  /select," & fcmd & " ")
    system.threading.thread.sleep(1000)
    Sendkeys.Send("{enter}")
End If
上述代码,bat文件在win10上执行,并不能将字体文件安装到系统,如何改代码才可以通过?
2楼
有点蓝 发表于:2024/6/11 21:24:00
试试:https://www.baidu.com/s?wd=c%23%20%E5%AE%89%E8%A3%85%E5%AD%97%E4%BD%93

Dim fontPath As String = projectpath & "Attachments\HYT_OMR_Jx.ttf"
dim fontSysFolder as string = "C:\Windows\Fonts\"
Dim args as string = "-install """ & fontPath & """"

Dim p As New Process() p.StartInfo.FileName = "cmd.exe" p.StartInfo.Arguments = "/C fontview " & args p.StartInfo.UseShellExecute = True p.Start()
共2 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .01953 s, 2 queries.