Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Shell command

Posted on 2007-03-21
8
250 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 143

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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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
 
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 143

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

791 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