而不是传递数字作为参数。我想传递IP地址的变量。我怎样才能做到这一点?我已经尝试过+运算符,但它没有用。
ShellExecute(
Application.handle,
'open',
'cmd.exe',
PChar('/c "mysqldump -h 192.168.100.1 -uroot database table > C:/Users/user1/Desktop/export.sql"'),
nil,
SW_show
);
如果我正确理解了您的问题,那么您正在寻找使用变量组合命令字符串的东西。你可以用几种方法做到这一点,这是一个(使用Format
函数):
var
IPAddress : string;
begin
IPAddress := '192.168.100.1';
ShellExecute(
Application.Handle,
'open',
'cmd.exe',
PChar(Format('/c "mysqldump -h %s -uroot database table > C:/Users/user1/Desktop/export.sql"', [IPAddress])),
nil,
SW_SHOW
);
end;