Click here to Skip to main content
12,999,417 members (55,972 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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ő 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 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
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170624.1 | Last Updated 27 Jan 2013
Copyright © CodeProject, 1999-2017
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