0

I have the following batch file: (name: u.bat)

@echo off start "" "C:\Program Files (x86)\IDM Computer Solutions\UltraEdit\Uedit32.exe" %1 rem exit 

I run the batch file in the temp folder to open an existing "readme.txt"

c:\temp> u readme.txt 

What is happening is the app is trying to open readme.txt in the C:\Program Files ....\UltraEdit directory and not the C:\temp directory.

How do I tell the batch file %1 is in the current directory?

3 Answers 3

1

you need to specify the PATH,

Syntax

Starts a separate window to run a specified program or command.

START ["title"] [/Dpath] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED] [/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL] [/WAIT] [/B] [command/program] [parameters]

path Starting directory

Sign up to request clarification or add additional context in comments.

1 Comment

This worked:start "" "C:\Program Files (x86)\IDM Computer Solutions\UltraEdit\Uedit32.exe" /D.\%1
0

Might be related to UltraEdit, but what you can do is include %~dp0 to get the current drive and path, like so

@echo off start "" "C:\Program Files (x86)\IDM Computer Solutions\UltraEdit\Uedit32.exe" .\%1 rem exit 

or

@echo off start "" /D . "C:\Program Files (x86)\IDM Computer Solutions\UltraEdit\Uedit32.exe" %1 rem exit 

2 Comments

I tried both of them, it'll now try to find the readme.txt in c:\utils where the u.bat file is.
Your are correct, it is indeed taking the path of the script called. Take the . as parameter, to get the current directory
0

This should also work and allow you to open more than one file:

@echo off start "" "C:\Program Files (x86)\IDM Computer Solutions\UltraEdit\Uedit32.exe" "%~f1" "%~f2" "%~f3" "%~f4" "%~f5" 

But you will probably find that this also works and the cmd window will close:

@echo off "C:\Program Files (x86)\IDM Computer Solutions\UltraEdit\Uedit32.exe" %* 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.