我有一份文件名列表,地址如下:
c:\ICT\AUTOCAD_2010\Customisations\20090409\20090409.lsp c:\ICT\AUTOCAD_2010\Customisations\Advanced偏移\LSP\高级OFFSET.lsp c:\ICT\AUTOCAD_2010\Customisations\Advanced c:\ICT\AUTOCAD_2010\LSP\acad2010doc.lsp
这份清单是非常基本的,但应附加如下:
加载“c:\ICT\AUTOCAD_2010\Customisations\20090409\20090409.lsp”) (加载“c:\ICT\AUTOCAD_2010\Customisations\Advanced偏移\LSP\高级OFFSET.lsp”) (load“c:\ICT\AUTOCAD_2010\Customisations\LockDWG\LSP\LockDWG.lsp”) (load“c:\ICT\AUTOCAD_2010\LSP\acad2010doc.lsp”)
如何使用VB.net来完成这一任务?
发布于 2011-08-17 16:08:57
如果您的文件不太大,则可以执行以下操作:
Dim fileContents As String, contentArray As String()
Dim updateContents As New StringBuilder("")
'read the file contents in
fileContents = My.Computer.FileSystem.ReadAllText("C:\TestInput.txt")
'split the contents on the space delimiter - this method will fail if you have a space in your filename
contentArray = fileContents.Split(" "c)
'loop through each file found in the data and format as required
For Each fileString As String In contentArray
updateContents.Append(String.Format("(load {0}{1}{0}) ", Chr(34), fileString))
Next
'write out the newly formatted file
My.Computer.FileSystem.WriteAllText("C:\TestOuput.txt", updateContents.ToString, True)https://stackoverflow.com/questions/7092362
复制相似问题