Delphi SetCurrentDir 设置当前文件夹路径


本文整理自网络,侵删。

 //设置当前文件夹 SetCurrentDir; ChDir; SetCurrentDirectory
var
dir: string;
begin
dir := 'c:\temp';
if SetCurrentDir(dir) then
ShowMessage(GetCurrentDir); //c:\temp

//或者
ChDir(dir); //无返回值

//也可以使用API:
SetCurrentDirectory(PChar(Dir)); //返回 Boolean
end;

=====================

function SetCurrentDir(const Dir: string): Boolean;
begin
{$IFDEF MSWINDOWS}
Result := SetCurrentDirectory(PChar(Dir));
{$ENDIF}
{$IFDEF LINUX}
Result := __chdir(PChar(Dir)) = 0;
{$ENDIF}
end;

相关阅读 >>

Delphi 使format输出百分号 %

Delphi 生成日志记录单元

Delphi tdictionary 泛型如何排序

Delphi listbox模糊查找文字

Delphi xe filesizebyname 要引用哪些文件

Delphi 内存管理[4]

Delphi如何把一个文本列表添加到tlistbox并避免重复项

Delphi datasnap 获取客户端ip

Delphi json

5种运行程序的方法具体应用实例

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...