Created
December 7, 2010 09:12
-
-
Save kimukou/731605 to your computer and use it in GitHub Desktop.
jnatest.groovy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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) | |
public static class SYSTEMTIME extends Structure { | |
public short wYear | |
public short wMonth | |
public short wDayOfWeek | |
public short wDay | |
public short wHour | |
public short wMinute | |
public short wSecond | |
public short wMilliseconds | |
} | |
void GetSystemTime(SYSTEMTIME result) | |
} | |
Kernel32Library.INSTANCE.SetCurrentDirectoryA("c:/Documents and Settings") | |
println "cmd /C cd".execute().text | |
println "--------------" | |
Kernel32Library.SYSTEMTIME time = new Kernel32Library.SYSTEMTIME() | |
Kernel32Library.INSTANCE.GetSystemTime(time) | |
println time.toString() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment