Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
Password Reminder
Register
| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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


Reply With Quote
  #2 (permalink)  
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


Reply With Quote
  #3 (permalink)  
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


Reply With Quote
  #4 (permalink)  
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

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 11:31 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.