Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
| Search | Today's Posts | Mark Forums Read
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 1st, 2006, 08:43 AM
Registered User
 
Join Date: Apr 2006
Location: , , Australia.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Copy File - but need Envirement Variable - VS 2005

Hello

I need help on the below code, im a absolute noob please be kind

I'll try to explain what im trying to do, XXXXX below needs to be replaced with path to SystemDrive, but i cant use %SystemDrive% Envirement Variable, i cant use C:\ as it is a fixed path(not all PC's have xp on c drive)

All i got to do is copy a file from my burnt cd (some Path) with my app to various xp installs

Code:
Public Sub Button20_Click() Handles Button20.Click
        Dim str As [String]
        Dim query As [String] = "%SystemDrive%"
        str = Environment.ExpandEnvironmentVariables(query)
        My.Computer.FileSystem.CopyFile("Register.key", "XXXXX\Program Files\Register.key")
End Sub
I know i sux at coding, but if anyone can help please please could u have full example. I appreciate any kind of feed back.
Thank You
:D


 
Old April 1st, 2006, 10:42 AM
Registered User
 
Join Date: Apr 2006
Location: , , Australia.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I figured it out

Code:
        Dim str As String
        Dim origFile As String = "1"
        Dim query As String = "%SystemDrive%"
        Dim copiedFile As String = "\Register.key"
        str = Environment.ExpandEnvironmentVariables(query)
        My.Computer.FileSystem.CopyFile(origFile, str + copiedFile)
:D


 
Old April 2nd, 2006, 02:53 AM
Registered User
 
Join Date: Apr 2006
Location: , , Australia.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I need help, please help.

I cant figure out how to just call a file by using a EnviorememtVariable to execute a file

Below is first bit, wont work


Code:

        Dim str As String
        Dim query As String = "%SystemDrive%"
        Dim sourceFile As String = "\WINDOWS\PCHealth\HelpCtr\Binaries\helpctr.exe"
        Dim addEmUp As String = "str + sourceFile"
        Str = Environment.ExpandEnvironmentVariables(query)
        Process.Start("addEmUp")


I tried this aswell, wont work


Code:

        Dim str As String
        Dim query As String = "%SystemDrive%"
        Dim sourceFile As String = "\WINDOWS\PCHealth\HelpCtr\Binaries\helpctr.exe"
        str = Environment.ExpandEnvironmentVariables(query)
        System.Diagnostics.Process.Start("str + sourceFile")

Any help or even suggestion would really be appreaciated. :D

Thank You


 
Old April 2nd, 2006, 03:49 AM
Registered User
 
Join Date: Apr 2006
Location: , , Australia.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Solved but not by me this time, below code works

Dim str AsString
Dim query AsString = "%SystemDrive%"
Dim sourceFile AsString = "\WINDOWS\PCHealth\HelpCtr\Binaries\helpctr.ex e"
Str = Environment.ExpandEnvironmentVariables(query)
System.Diagnostics.Process.Start(str + sourceFile)


Thank You All

Places ive been for help

http://www.vbdotnetforums.com/showthread.php?t=9552
http://www.vbcity.com/forums/topic.asp?tid=124109
http://p2p.wrox.com/topic.asp?TOPIC_ID=42262
http://forums.microsoft.com/MSDN/Sho...28521&SiteID=1





Similar Threads
Thread Thread Starter Forum Replies Last Post
Using param/variable to copy attributes shahbhat XSLT 2 August 27th, 2008 04:03 PM
How to Copy a File using VB 2005? phenom BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 11 July 31st, 2008 01:23 AM
c# windows App: Copy Rights Version Dotnet 2005 winbala .NET Framework 2.0 2 April 7th, 2008 04:02 AM
Restore/copy database from SQL 2005 to 2000 shillr SQL Server 2005 2 April 1st, 2008 11:14 AM
Macro to copy data from one file to a 2nd file chadpodsednik Excel VBA 1 October 29th, 2004 10:40 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.