最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

problem with command line syntax gzip vb.net - Stack Overflow

programmeradmin3浏览0评论

Good afternoon. In VB NET I would like to create a procedure for compressing a file with gzip from command line. In a folder (c:\tmp) I have the gzip.exe file and a sql file (origine.sql). From Windows shell (cmd.exe) the command:

gzip  -c -7 -f -k origine.sql > destinazione.sql.gz

works correctly and the compressed file is created.

But with this VB NET code :

Dim Origine As String = "c:\tmp\origine.sql"
Dim Destinazione As String = "c:\tmp\destinazione.sql.gz"
Dim p0 As New ProcessStartInfo
p0.FileName = "c:\tmp\gzip.exe"
p0.Arguments = " -c -7 -f -k " & Chr(34) & Origine & Chr(34) & " > " & Chr(34) & Destinazione & Chr(34)
Process.Start(p0)

the process starts (I see that the shell window opens for a moment, but I'm not convinced because for a moment I see a series of characters scrolling as if I had omitted > destination.sql.gz in the shell) but no destination file is created.

Also replacing argument string whit this one:

    p0.Arguments = " -c -7 -f -k " & Chr(34) & Origine & Chr(34) & " -r " & Chr(34) & Destinazione & Chr(34)

(replacing '>' with '-r') then problem is the same.

Where am I wrong?

Thanks

Chico

发布评论

评论列表(0)

  1. 暂无评论