1.

Solve : Can't get batch file to start program in partition?

Answer»

I've researched this a fair bit. Can't get an exe on a different partition (M:\program files\grisoft\avg free\avgw.exe) to open when I'm logged into my D: drive partition. Tried the quotes (start "M:\program files\grisoft\avg free\avgw.exe") & short filename (start M:\progra~1\grisoft\avgfre~1\avgw.exe)(ALSO tried it in quotes). Windows XP, Fat32 on the D partition, M partiton is formatted Fat32, no o/s.What error message did you receive? "Bad command or filename" usually means a typo or the file does not exist. Some programs need components to run. If you run from an icon, the "Start in" parameter usually takes care of where to look. In a batch file or at the command line you may have to change directory to the .exe location before you can run.

Hope this helps. Thanx for the quick response, Sidewinder. There's no error message per se. The only window showing is a dos-like window named "M:\program files\grisoft\avg free\avgw.exe" & at the prompt it shows the location of the batchfile D:\....desktop. Yes, when this particular exe (avgw.exe)is run from an icon (shortcut on my desktop), the "start in" is where the program folder is located (M:\). After some searching, I followed a recommendation to d/l Cmdhere MS powertoys, which gave me the ability to open a dos window in the M:\ partiton. Typing M:\program files\grisoft\avg free\avgw.exe did open the exe I wanted. However, when in the D:\ partition, I can't get the dos prompt to cd to M:\, or is "cd" the wrong command for that? Or do you know what the syntax is for cd M:\ in a batchfile? TYOn XP you can change drive and directory with one command:

cd /d m:\

pushd m:\ also works.

Hey S/W! TY for the info. We're getting much closer! Yes, I can switch the partitions using the syntax you suggested, however, I can't seem to start the exe from the commandline nor incorporate the syntax into a batchfile... Here's an example of what I've been using in a batch;

cd /d m:\
start M:\PROGRA~1\Grisoft\AVGFre~1\avgw.exe

When I use the above, I get an error saying "windows cannot find" the file. Yet when I use the home drive in that commandline, it works fine (minus the "cd /d m:\", of course)



At the prompt I've used this (among other variations);

M:\> start "m:\program files\grisoft\avg free\avgw.exe"

When I do this, it just brings up another dos window. :-/

I just tried the short filename convention at the prompt & got the same "windows cannot find" file error.
You could try this:

Code: [Select]
cd /d M:\PROGRA~1\Grisoft\AVGFre~1
start avgw


If that doesn't work, try WITHOUT the START.There may be a message in the Window that flies by. Check to make sure that AVGW is in fact the correct executable.

Curious: is AVG installed to the OS on the C drive? There could be references to files not logically connected to the XP system....just a thought

Good luck. Hi Sidewinder. You are da man! Yupper, the last syntax got it! As far as your question as to where AVG is installed, my rig has 2 hd's & 13 partitions (various windows o/s's, some blank or formatted partitions & soon to be Mepis Linux). AVG is on the partition that has most of my progs, M:\. I typically run my desktop off of the D or I xp partitons. C is win98.
I'll tell ya what I'm up to. I want to have AVG (or any other program) run, delete any viruses (or whatever), close, then have a report generated on all the activity. I've dabbled with Visual Basic 6 & various batchfile programs (Batchrun, Autoit, etc) & so far, batchfiles look like what I'll be using to accomplish this. Yes, I know I could just make a shortcut to AVG's selfgenerated report to see what it's done, but I'm just testing out various methods on AVG. Thank you for all your input. Whaddaya think? MikeWith 2 HDDs with 13 partitions and various OS versions, you hardly need my thoughts. I agree with you that batch files are the way to go since they are the lowest common denominator. With Scripts you may find that some versions of Windows do not support all the COM objects needed.

I never FOUND third party tools (Batchrun and Autoit) to be much help, but some people swear by them. Personally I find them redundant since Windows has most of the tools you need...just hard to find sometimes.

Maybe you should try something like VMWare ($$$). You could have all the OSes running concurrently and hotkey between them. Should make for some really spectacular fireworks.

One question: How do you maintain all this?

Good luck. Heh... It's not as impressive as it might SOUND. Although, with this many partitions, there's a piece of free software called 'Restart' by Gabriele Ponti (http://www.gabrieleponti.com/software) that is great for restarting into various partitions with 1 click (in combination with batchfiles) with various parameters for forced shutdown, etc. Gabriele is very responsive & community oriented, just a great guy.

You mentioned that windows has most of the tools you need to automate tasks, but that they can be hard to find. I guess mine is a case in point. How did you learn so much about batchfiles?

Ya, using VMWare to hotkey between os's would come in handy at times for sure. I service people's computers & to have various configurations so readily available would definitely make my job EASIER (maybe even make some fireworks! ).

When you say 'maintain all this', do you mean updates,etc? There are only 2 partitions that I typically boot to, the others are more for troubleshooting or testing, so they aren't really maintained. My E partiton I used for a year or so, then when it got too unwieldy, I migrated to another. That sort of thing.

Mike



Discussion

No Comment Found