Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need to copy file to C;\ after I browsefor file 1

Status
Not open for further replies.

marken1984

Technical User
Mar 27, 2009
1
US
I am new to scripting. I wrote a batch file which let me browse for a file and then export it. I wrote another batch file to flatfile it to a server. I would like to combine them. I can browse for file to choose the file I am interested in I can also call up the batch file to file the results to the server. I can't take the file I browse for and copy it to a new location. I can't use pathways because there are too many csv files. I need to choose one. Any help would be appreciated
 
Here is a short HTA script that will do it. Has a browse for a file, a process copy button and exit button.

Save into a *.hta file and run.

Code:
<html>
<head>
<title>Copy a File</title>
<HTA:APPLICATION ID="oMyApp"
  APPLICATIONNAME="My Application"
  BORDER="yes"
  CAPTION="yes"
  ICON="myicon.ico"
  SHOWINTASKBAR="yes"
  SINGLEINSTANCE="yes"
  SYSMENU="yes"
  WINDOWSTATE="normal">
</head>

<script language="VBScript">

Sub CopyFile
	Dim fso
	Set fso = CreateObject("Scripting.FileSystemObject")
	fso.CopyFile UploadME.value, [COLOR=red]"C:\"[/color] [b] = Path to copy the file to.[/b]
	HackJob.InnerHTML = "<b>File has been Copied</b>"
End Sub

Sub ExitHta
	Set fso = nothing
	Self.close
End Sub

</script>

<body>
<h3>Select a File To Copy</p>
<input type="file" name="UploadMe" size="75">
<br><br>
<input type="button" value="Process File" name="UploadButton" onclick="CopyFile">
<input type="button" value="Exit Program" name="ExitButton" onclick="ExitHta">
<br><br>
<span id = "HackJob"</span>
</body>
</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top