Solved

Shell command

Posted on 2007-03-21
8
232 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
groupSum5 challenge 5 71
passing a value with stream reader AFTER a ";" 3 58
Help me. 3 48
Child Form in front 4 39
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 …
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

895 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

18 Experts available now in Live!

Get 1:1 Help Now