writing output to directory where exe is opened from

后端 未结 2 1459
时光取名叫无心
时光取名叫无心 2021-01-26 07:32

I have a form exe. now on button click i want it to save a file to where it has been opened from, e.g. if i give this exe to you and you copy it to c

2条回答
  •  没有蜡笔的小新
    2021-01-26 08:06

    You can have a look at using AppDomain.BaseDirectory Property

    Gets the base directory that the assembly resolver uses to probe for assemblies.

    You also need to look at using Path.Combine Method (String, String)

    Combines two strings into a path.

提交回复
热议问题