Running Console Application From a .Bat File

G

Guest

I am wanting to invoke a console application by double clicking on a ".Bat"
file from a shared drive. The ".Bat" file will access another shared drive
to actually invoke the application.

The person double clicking on the file has read/write access to both shared
drives.

Can this be done?

In the bat file I attempt to execute the file by suppling a command which
looks like the following:

\\PKCAP208\Ddrive208$\Products\Batch Jobs\MetricBatchLoad\MyPrgm.exe MyParm

It does not seem to like me specifying the drive in this manner. Is there a
way for me to do this in the ".bat" file?
 
S

Stefan Simek

I can't find what does this post to do with the C# language... ;)

But I guess you're out of luck. AFAIK, the command line interpreter
(cmd.exe) used for .bat files doesn't handle the UNC paths.

You actually can do something like:

1. copy the file from the network share to a mapped drive
2. run it from there

OR

1. map the share to a letter (a problem here might be finding a free letter)
(NET USE)
2. run it through the letter path
3. remove the mapping

But why not use a link (.lnk) instead?

HTH,
Stefan
 
J

James Curran

But I guess you're out of luck. AFAIK, the command line interpreter
(cmd.exe) used for .bat files doesn't handle the UNC paths.

You sure? An empirical test on my machine seems to show otherwise....
He will have to wrap in path in quote, as it has a space in it.:

"\\PKCAP208\Ddrive208$\Products\Batch Jobs\MetricBatchLoad\MyPrgm.exe"
MyParm

--
Truth,
James Curran
[erstwhile VC++ MVP]
Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top