开发者

How I can create and remove a network drive from Inno Setup?

开发者 https://www.devze.com 2023-03-18 04:57 出处:网络
I\'m writing a Inno Setup script which need to execute a very old third party setup application, this old installer (called setup.exe) only works from a root folder (i开发者_如何学Cf not fails), so I

I'm writing a Inno Setup script which need to execute a very old third party setup application, this old installer (called setup.exe) only works from a root folder (i开发者_如何学Cf not fails), so I need to create (and remove) a network drive to copy the files of this installer and then execute the setup.exe. so the question is how i can create and remove network drive from Inno Setup? I am looking something like the WNetAddConnection function.


You can use the WshNetwork object, which is part of the Windows Script Host:

var
  WshNetWork : Variant;
begin
  WshNetWork:=CreateOleObject('WScript.Network');
  //create the network drive
  WshNetwork.MapNetworkDrive('H:', '\\localhost\c$\data');

  //do your stuff here

  //remove the network drive
  WshNetwork.RemoveNetworkDrive('H:');
end;
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号