Solved

Shell command

Posted on 2007-03-21
8
220 Views
Last Modified: 2010-04-30
Hi: Can any one please tell me how to i use the shell command to copy file from one location to another. I try to copy from vpath2 into strdestination and it create a file but its blank

ShellExecute 0, vbNullString, Chr(34) & vPath & vFile & Chr(34), vbNullString, vbNullString, vbMaximizedFocus

Option Explicit
Public Declare Function ShellExecute Lib "shell32.dll" _
   Alias "ShellExecuteA" (ByVal HWnd As Long, ByVal lpOperation As String, _
   ByVal lpFile As String, ByVal lpParameters As String, _
   ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
0
Comment
Question by:mustish1
  • 4
  • 2
  • 2
8 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 18763942
why do you not use the FileCopy command?

anyhow, what is the value of vPath and vFile? maybe you do not call the ShellExecute properly?
0
 

Author Comment

by:mustish1
ID: 18764023
vpath=inputpath.text
vfile=outputpath.text

vpath-->C:\Documents and Settings\khamu443\My Documents\temp20070321-100914.xls
vfile-->C:\REMITandNSF\New_Import_PCDI03_032107.txt

Thanks.
0
 

Author Comment

by:mustish1
ID: 18764025
OOPS I am sorry
vpath-->C:\Documents and Settings\khamu443\My Documents\temp20070321-100914.txt
0
 
LVL 20

Expert Comment

by:hes
ID: 18764055
If this is the case here is your statement
ShellExecute 0, vbNullString,  "C:\Documents and Settings\khamu443\My Documents\temp20070321-100914.txtC:\REMITandNSF\New_Import_PCDI03_032107.txt" ,vbNullString, vbNullString, vbMaximizedFocus

You arent trying to execute anything and
Chr(34) & vPath & vFile & Chr(34), is all togeather

0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 20

Expert Comment

by:hes
ID: 18764064
as angel stated why not just use VB's native FileCopy

FileCopy(vpath,vfile)
0
 

Author Comment

by:mustish1
ID: 18764106
ok thanks. But if you please tell me how to i copy from vpath into vfile thru shellexecute command
0
 

Author Comment

by:mustish1
ID: 18764132
I try to use the variable names but it gives syntax error.
ShellExecute 0, vbNullString, vpath2 strDestination, vbNullString, vbNullString, vbMaximizedFocus
0
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 18764155
>ok thanks. But if you please tell me how to i copy from vpath into vfile thru shellexecute command
please try this:
ShellExecute 0, vbNullString, "cmd /c copy """ & vPath & """ """& vFile & """ ", vbNullString, vbNullString, vbMaximizedFocus
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now