Using .bat file to open file in diff location

February 2017




Issue


I'm working on developing a menu for a USB flash drive.

I have .bat file that opens a spreadsheet with a program that is installed on the flash drive.
The code looks something like this:

Start /d \Folder1\folder2\folderofprogram Name of program.exe "Name of file.ods"

This code works well but the problem is I need to have the file in the same directory as the program.
Is there a way to make the .bat file open the file from a different directory on the USB flash drive?



I think this is a simple problem but was not able to find any information about it.

Solution


Use UNC path name. so something like this:
 \\computername\folder\filename 

or
\\mypc\c:\windows\testfile.exe 

Note


Thanks to Neomagus for this tip on the forum.

Related


Published by aakai1056. Latest update on February 17, 2010 at 03:31 AM by aakai1056.
This document, titled "Using .bat file to open file in diff location," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (ccm.net).