New to batch files

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
dan
Posts: 2
Joined: 18 May 2015 03:58

New to batch files

#1 Post by dan » 18 May 2015 04:04

I have an issue with the directory in my batch files, they will work fine on my computer but not anyone else's because they are pointing to specific folders I need them to point the the current directory they are in any help much appreciated.
This is an example of my current commands:
"C:\Users\Daniel\Desktop\fnr.exe" --cl --dir "C:\Users\Daniel\Documents\vb6\Tare Original\copy" --fileMask "*.frm" --excludeFileMask "*.dll, *.exe" --useRegEx --find "(\w+\sVB.Form\s\w+\s+\w+\s+=\s+)&H00400000&" --replace "$1&H00E4E4E4&"

I need to change the location of the point to the .exe and the copy folder to the current directory?

ShadowThief
Expert
Posts: 1167
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: New to batch files

#2 Post by ShadowThief » 18 May 2015 09:53

The current directory as in the directory that the batch script is currently in?

That can be found with the variable %~dp0

Although if the path has spaces anywhere in it, you'll need to use "%~dp0" to preserve them.

dan
Posts: 2
Joined: 18 May 2015 03:58

Re: New to batch files

#3 Post by dan » 18 May 2015 10:05

Thanks dude but i found a solution

"fnr.exe" --cl --dir "%cd%" --fileMask "*.frm" --excludeFileMask "*.dll, *.exe" --useRegEx --find "(\w+\sVB.Form\s\w+\s+\w+\s+=\s+)&H00400000&" --replace "$1&H00E4E4E4&"

Post Reply