Click here to Skip to main content
11,803,861 members (78,978 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C# VB Delphi
I write a database software by Delphi. DB is SQL Server and has install on server . User save record to bank. For every record there is an attachment file which must be save in server. File must be save in a folder in server and it’s Address must be save in bank.
I write 2 below commands:
ShellExecute(Handle, 'open', 'psexec', '\\ -u user1 -p hamed123 -c test1.txt' '', SW_HIDE);
CopyFile('test1.txt', '\\\share_folder$\test1.text, False);
1- Parameter -c test1.txt don’t copy file test1.txt to server . this work be do by CopyFile. But if I don’t write this parameter for psexec, the connection to server will not be open. How can I use psexec for open connection without that parameter?
2- Is there any commands for open connection to server like “psexec”? is “psfile” ? how it work?
3- When a connection be opened by “psexec”, after some seconds, the connection will be closed, Unless copy and paste file between client and server be done frequently. How can we increase the connection time ?

Please reply me full commands for do this work.
Thanks very much
Posted 27-Jan-13 0:26am
Zoltán Zörgő at 27-Jan-13 7:18am
I didn't get your point why you need psexec at fist place. If I understand you correctly you want to copy a file to a server share that needs different user to be authenticated as the one running the application. Psexec can do this for you but not this way, actually this is not the tool for it. Do you need a solution in Delphi? And what version? Do you make native code, or .net?
armm1388 at 27-Jan-13 23:16pm
yes i want code in delphi

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Take a look here[^] for correct use of the options, and help forum.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 450
1 CPallini 320
2 F-ES Sitecore 240
3 Sergey Alexandrovich Kryukov 234
4 CHill60 220
0 OriginalGriff 3,000
1 Maciej Los 1,910
2 KrunalRohit 1,862
3 CPallini 1,755
4 Richard MacCutchan 1,187

Advertise | Privacy | Mobile
Web02 | 2.8.151002.1 | Last Updated 27 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100