Visual Basic .NET Forums    

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

VB.NET Forums Newsletter Signup:
Email address:


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

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-04-2008, 9: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?
Reply With Quote
  #2 (permalink)  
Old 11-04-2008, 10:06 AM
VB.NET Forum Newbie
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: May 2007
Posts: 26
Reputation: 22
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")
Reply With Quote
  #3 (permalink)  
Old 11-04-2008, 10: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 5:27 PM.
Reply With Quote
  #4 (permalink)  
Old 11-04-2008, 9:50 PM
JuggaloBrotha's Avatar
VB.NET Forum Moderator
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Jun 2004
Location: Lansing, MI; USA
Age: 24
Posts: 2,996
Reputation: 212
JuggaloBrotha a shining VB.NET starJuggaloBrotha a shining VB.NET starJuggaloBrotha a shining VB.NET starJuggaloBrotha a shining VB.NET starJuggaloBrotha a shining VB.NET star
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.

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.

For an extensive list of MS Service packs and extensions: http://www.juggalobrotha.com/
Reply With Quote
  #5 (permalink)  
Old 11-08-2008, 3: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
Reply With Quote
  #6 (permalink)  
Old 11-08-2008, 6:51 PM
VB.NET Forum Newbie
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: May 2007
Posts: 26
Reputation: 22
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 8:06 PM.
Reply With Quote
  #7 (permalink)  
Old 11-10-2008, 7:25 AM
VB.NET Forum Enthusiast
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Nov 2006
Location: UK
Age: 25
Posts: 39
Reputation: 29
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.
Reply With Quote
  #8 (permalink)  
Old 11-10-2008, 4:07 PM
VB.NET Forum Newbie
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: May 2007
Posts: 26
Reputation: 22
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.
Reply With Quote
  #9 (permalink)  
Old 11-10-2008, 4:14 PM
VB.NET Forum Enthusiast
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Nov 2006
Location: UK
Age: 25
Posts: 39
Reputation: 29
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
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 6:33 AM.




Click to advertise here

Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
For advertising opportunities click here.