Skip to content

Instantly share code, notes, and snippets.

@bluepapa32
Created December 7, 2010 08:52
Show Gist options
  • Save bluepapa32/731596 to your computer and use it in GitHub Desktop.
Save bluepapa32/731596 to your computer and use it in GitHub Desktop.
Groovy+JNA
@Grab('net.java.dev.jna:jna:3.2.7')
import com.sun.jna.*;
import com.sun.jna.win32.*;
interface Kernel32Library extends StdCallLibrary {
Kernel32Library INSTANCE = Native.loadLibrary("kernel32", Kernel32Library.class);
boolean SetCurrentDirectoryA(String dir);
}
Kernel32Library.INSTANCE.SetCurrentDirectoryA("c:/Documents and Settings")
println "cmd /C cd".execute().text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment