Visual Basic .NET Forums  

Go Back   Visual Basic .NET Forums > VB.NET > Deployment

Deployment Discussions related to installation, patching/updates, no touch deployment, etc.

VB.NET Forums Newsletter Signup:
Email address:


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-04-2008, 8:49 AM
VB.NET Forum Newbie
.NET Framework: .NET 1.1 (VS 2003)
 
Join Date: Nov 2008
Age: 14
Posts: 3
Reputation: 0
bobbel is on a distinguished programming path ahead
Default including a file in my exe

hello everybody!

i have a problem. What i want is that i can include a file (a bat or something) and that i can say in my code Shell("clean.bat") without that file being in the same folder as my exe. How do i do that?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 11-04-2008, 9:06 AM
VB.NET Forum Enthusiast
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: May 2007
Posts: 30
Reputation: 28
shawnplr is on a distinguished programming path ahead
Default

You can use
shell("C:\folder\clean.bat")
or if the bat file is in the same folder as your exe use
shell(Application.StartupPath() & "\clean.bat")
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 11-04-2008, 9:21 AM
VB.NET Forum Newbie
.NET Framework: .NET 1.1 (VS 2003)
 
Join Date: Nov 2008
Age: 14
Posts: 3
Reputation: 0
bobbel is on a distinguished programming path ahead
Default

what i want is to embed the file in my exe and that i can execute my .bat with shell("clean.bat") anybody know? nvm, did it otherwise

Last edited by bobbel; 11-04-2008 at 4:27 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 11-04-2008, 8:50 PM
JuggaloBrotha's Avatar
VB.NET Forum Moderator
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Jun 2004
Location: Lansing, MI; USA
Age: 25
Posts: 3,278
Reputation: 259
JuggaloBrotha puts e.f. hutton to shameJuggaloBrotha puts e.f. hutton to shameJuggaloBrotha puts e.f. hutton to shameJuggaloBrotha puts e.f. hutton to shameJuggaloBrotha puts e.f. hutton to shameJuggaloBrotha puts e.f. hutton to shame
Default

Before you can run a file like that you need to make a copy of it outside your exe file, you can use a FileStream to copy it out of the resources, then run it using Process.Start("Path to file")
__________________

There are 3 kinds of people in the world: Those who can count and those who can't.
4 out of 3 people have trouble with fractions.

Windows has a 64 bit GUI for a set of 32 bit extensions on a 16 bit shell for an 8 bit OS using a 4 bit kernel made by a 2 bit company that can't stand 1 bit of competition.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 11-08-2008, 2:28 AM
VB.NET Forum Newbie
.NET Framework: .NET 1.1 (VS 2003)
 
Join Date: Nov 2008
Age: 14
Posts: 3
Reputation: 0
bobbel is on a distinguished programming path ahead
Default

well, what i did: when you press a button, it print a bat file that ends with "del clean.bat" and then executes it, so you can't read it and you nearly can't copy it
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 11-08-2008, 5:51 PM
VB.NET Forum Enthusiast
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: May 2007
Posts: 30
Reputation: 28
shawnplr is on a distinguished programming path ahead
Default

Sorry if my guess is wrong. Judging by the name of your bat file. If you are deleting all files in a folder then you can use this.
Code:
For Each foundFolder As String In My.Computer.FileSystem.GetDirectories("C:\Test")
            My.Computer.FileSystem.DeleteDirectory(foundFolder, FileIO.DeleteDirectoryOption.DeleteAllContents)
        Next
For Each foundFile As String In My.Computer.FileSystem.GetFiles( "C:\Test", FileIO.SearchOption.SearchAllSubDirectories, "*.*")
            My.Computer.FileSystem.DeleteFile(foundFile, FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.DeletePermanently)
        Next
I modified the code from here.

Last edited by shawnplr; 11-08-2008 at 7:06 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 11-10-2008, 6:25 AM
VB.NET Forum Enthusiast
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Nov 2006
Location: UK
Age: 25
Posts: 54
Reputation: 36
LeonR is on a distinguished programming path ahead
Default

Quote:
Originally Posted by bobbel View Post
well, what i did: when you press a button, it print a bat file that ends with "del clean.bat" and then executes it, so you can't read it and you nearly can't copy it

If you really want a batch file... and it must be part of the exe..

My work around would be to create a sub routine which actually creates a new batch file and writes the content to it.

Then run the file and after the execution has completed, delete it.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 11-10-2008, 3:07 PM
VB.NET Forum Enthusiast
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: May 2007
Posts: 30
Reputation: 28
shawnplr is on a distinguished programming path ahead
Default

Quote:
Originally Posted by bobbel View Post
well, what i did: when you press a button, it print a bat file that ends with "del clean.bat" and then executes it, so you can't read it and you nearly can't copy it
Yes Leon he did just that.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 11-10-2008, 3:14 PM
VB.NET Forum Enthusiast
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Nov 2006
Location: UK
Age: 25
Posts: 54
Reputation: 36
LeonR is on a distinguished programming path ahead
Default

Damn!

I really need to read the posts a bit better! Thats the 2nd one I misread today
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





All times are GMT -4. The time now is 9:13 PM.

Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0


For advertising opportunities click here.