Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Nov 30th, 2005, 8:18 PM   #1
Silent
Newbie
 
Join Date: Nov 2005
Posts: 11
Rep Power: 0 Silent is on a distinguished road
Open File Problem :(

Hello everybody..i'm knew here and looking for a bit of help..heres my problem:

I am in the process of building a program to Install some programs silently from a PC. this program is basically a GUI that will start a few batch files that actually install the programs.

The main issue is with a = Shell("""\Google Toolbar\AI.cmd""") or anything similar, the program will succesfully load up the batch file, however the batch file will then say "GoogleToolbarInstaller.exe cannot be found. I Know there is no issue with the actuall batch file because it works fine if it is ran alone.

Anyone with any suggestions please post, i'm at the end of my teather with this problem.

Thanks alot
Silent is offline   Reply With Quote
Old Dec 1st, 2005, 2:49 PM   #2
Rory
Expert Programmer
 
Rory's Avatar
 
Join Date: Jan 2005
Location: London
Posts: 542
Rep Power: 4 Rory is on a distinguished road
Send a message via MSN to Rory
You seem to be using a relative path with quotes: for long filenames you need a dot, or you can form the absolute path "manually". However on Windows NT and later, BAT PIF and CMD are no longer natively executable. Try the ShellExecute API / whatever the .NET FW wrapper is, or you can use the inbuilt Shell "command.com /c batchfile". However in VB.NET you shouldn't be relying on VB6 compatibility namespaces containing hangover aliases, and you also lose some functionality.
Rory is offline   Reply With Quote
Old Dec 1st, 2005, 5:04 PM   #3
Kilo
Expert Programmer
 
Kilo's Avatar
 
Join Date: Nov 2005
Location: In Pink Clam?
Posts: 542
Rep Power: 0 Kilo is an unknown quantity at this point
Send a message via AIM to Kilo
dude your messed up!!! i cannot stand stupid little shit like that... why in the hell would anyone help this guy silenting install programs on your machine... this is an ongoing problem wih people now and days.. i don't even know what to say excpet, you need go back to school, get a degree and learn to make an honest living. What you are trying to do should be against a privacy policy with microsoft or something. stupid shit man... stupid shit
__________________
"When in Rome, Do as the Romans Do"
"Beauty is in the eye of the BEER holder"
"Save your breath your going to need it for your blow up doll later"

SearchLores.org
Kilo is offline   Reply With Quote
Old Dec 1st, 2005, 7:21 PM   #4
Silent
Newbie
 
Join Date: Nov 2005
Posts: 11
Rep Power: 0 Silent is on a distinguished road
Kilo: Please stfu, and read:

This program is being made for my job, i build around 8 PC's a day. We normaly use Norton Ghost to ghost the same image to the same Motherboard type PC, eg, if the components are the same, we just ghost. However sometimes we have to build with boards we don't have a ready made ghost image for, therefore, i am making this program to install quickly the normal tools we put on PC's to help the noobies keep there PC ok. (AdAware Etc)

So if you've finished saying "Stupid Shit", why don't you think about what your saying you dick.

Rory: Thanks for your reply, however i'm a bit of a novice, i'm on a course at the moment in programming...
Can you explain what the .net FW wrapper is?

Shell "command.com /c batchfile << how does this work? is it the same as "A = Shell ("/FileDir/File.exe")?

Thanks
Silent is offline   Reply With Quote
Old Dec 2nd, 2005, 2:10 PM   #5
Rory
Expert Programmer
 
Rory's Avatar
 
Join Date: Jan 2005
Location: London
Posts: 542
Rep Power: 4 Rory is on a distinguished road
Send a message via MSN to Rory
Silent, what I meant was that the Shell command is simply a shortcut method for people experienced with VB6 which hides a lot of the improved native functionality you get with the .NET Framework (FW). Microsoft.VisualBasic.Interaction.Shell() will only execute natively executable files (.exe, .com) whereas the Process class enables you to call the ShellExecute API to launch so-called "helper" applications:

        Dim AProcess As System.Diagnostics.Process = New System.Diagnostics.Process
        With AProcess
            .StartInfo.FileName = "C:\Windows\Gone Fishing.bmp"
            .StartInfo.UseShellExecute = True
            .Start()
        End With

The important line is .StartInfo.UseShellExecute = True, you are instructing the class that the file is not directly executed, but run with another program defined in the registry (probably paint), whereas you cannot do this simply using the Shell method.

In your case you can substitute .StartInfo.FileName = "somefile.cmd" as command.com is the helper app for those files, which will run as if you double clicked them. N.B. you may need to specify the absolute path - AppDomain.CurrentDomain.SetupInformation.ApplicationBase() gives you the path the application is running from.
Rory is offline   Reply With Quote
Old Dec 2nd, 2005, 2:20 PM   #6
Ghost
Man Bear Pig Hunter
 
Ghost's Avatar
 
Join Date: Jul 2005
Location: NorCal, USA
Posts: 290
Rep Power: 4 Ghost is on a distinguished road
Flame on Silent and Kilo!



Flame on......


I do see your point for making such a program, but as I too make computers, sometimes its best to use Ghost for Imaging computers, but I guess if you are just installing Ad-Aware and other small, none hardware dependent programs, it makes sense....who do you work for?
Ghost is offline   Reply With Quote
Old Dec 2nd, 2005, 5:50 PM   #7
Silent
Newbie
 
Join Date: Nov 2005
Posts: 11
Rep Power: 0 Silent is on a distinguished road
Ghost:
I Work for a medium sized company in England. Its called Halifax Computers Ltd (www.halifaxcomputers.co.uk)

Rory:
Many thanks, I've give your code a going at but still no luck. It gives the same error as i started with, (the one with the batch file saying it couldn't find the file specified, yet it works fine when ran by the user)

Any other idea's?
Thanks again
Silent is offline   Reply With Quote
Old Dec 2nd, 2005, 6:33 PM   #8
Silent
Newbie
 
Join Date: Nov 2005
Posts: 11
Rep Power: 0 Silent is on a distinguished road
Rory:
I've been having a look to see what other problems it could be and, found it can't be any of these:

CD Problem - I Tryed executing the batch on a Hard Drive
Batch File - Tested and Fine

Therefore, it must be something to do with VB. there is no other explanation...
Silent is offline   Reply With Quote
Old Dec 2nd, 2005, 6:43 PM   #9
Ghost
Man Bear Pig Hunter
 
Ghost's Avatar
 
Join Date: Jul 2005
Location: NorCal, USA
Posts: 290
Rep Power: 4 Ghost is on a distinguished road
Why not put the batch files and all setup.exe files in the same folder so you can do relitive paths? I'm not sure if that is the issue, but its a thought.

EDIT: Also, for the CD purposes are you telling the program to pic the same drive it is on, try debugging and see where the strings lead you.
Ghost is offline   Reply With Quote
Old Dec 2nd, 2005, 7:25 PM   #10
Silent
Newbie
 
Join Date: Nov 2005
Posts: 11
Rep Power: 0 Silent is on a distinguished road
Yes ghost, The program is set so it opens it from the current dir.

The reason the "setup.exe" and batch files aren't in the same Dir is because the disc has 2 use's and this isn't workable. (Don't Ask)
Silent is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

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
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 6:59 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC