Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# VB Delphi
Hi
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', '\\194.168.35.1 -u user1 -p hamed123 -c test1.txt' '', SW_HIDE);
CopyFile('test1.txt', '\\194.168.35.1\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 1:26am
Comments
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
good
Please Sign up or sign in to vote.

Solution 1

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

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

  Print Answers RSS
0 OriginalGriff 240
1 Kamal Rocks 184
2 PIEBALDconsult 150
3 BillWoodruff 148
4 Jochen Arndt 135
0 OriginalGriff 5,695
1 DamithSL 4,506
2 Maciej Los 4,007
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,190


Advertise | Privacy | Mobile
Web03 | 2.8.141216.1 | Last Updated 27 Jan 2013
Copyright © CodeProject, 1999-2014
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