How to get current relative directory of your Makefile?

The shell function. You can use shell function: current_dir = $(shell pwd). Or shell in combination with notdir, if you need not absolute path: current_dir = $(notdir $(shell pwd)). Update. Given solution only works when you are running make from the Makefile’s current directory. As @Flimm noted: Note that this returns the current working directory, … Read more

Why does ‘Run as administrator’ change (sometimes) batch file’s current directory?

Which directory is current working directory on starting a batch file with context menu item Run as administrator depends on User Account Control (UAC) setting for the current user. This can be demonstrated with following small batch file C:\Temp\Test.bat: @echo Current directory is: %CD% @pause With having selected in User Account Control Settings Default – … Read more

changing the working-directory of command from java

To implement this you can use the ProcessBuilder class, here’s how it would look like: File pathToExecutable = new File( “resources/external.exe” ); ProcessBuilder builder = new ProcessBuilder( pathToExecutable.getAbsolutePath(), “-i”, “input”, “-o”, “output”); builder.directory( new File( “resources” ).getAbsoluteFile() ); // this is where you set the root folder for the executable to run with builder.redirectErrorStream(true); Process … Read more