.git/hooks/pre-commit 2>&1 | sed '/^*/d' | sed 's/:.*//' | uniq for FILE in `.git/hooks/pre-commit 2>&1 | sed '/^*/d' | sed 's/:.*//' | uniq` ; do sed -ie 's/[[:space:]]*$//' $FILE ; done
Tag Archive for windows
Git whitespace fixes for windows newlines
stringToList (VBScript)
Function stringToList(AString, ADelimt) Dim theList() Dim work Dim c1, arCount work = AString c1 = 1 arCount = -1 Do While (c1 > 0) c1 = InStr(work,ADelimt) If c1 > 0 Then arCount = arCount + 1 ReDim Preserve theList(arCount) theList(arCount) = Left(work,(c1-1)) work = Mid(work,c1+1,Len(work)) End If Loop arCount = arCount + 1 ReDim Preserve theList(arCount) theList(arCount) = work stringToList = theList End Function
Parse Command Line Parameters (VBScript)
Function CmdLineParam(AStartAt, AsingleSwitch, AMatchCase, ALongSwitch, AAssigned, APosition, AFollowing) ' AStartAt Which argument position to start at (Zero based). ' ASingleSwitch single character param char. -a -A ' AMatchCase singleSwitch should be came case for a match ' ALongSwitch Long Switch value that is preceed by --. i.e. --test --file= ' AAssigned Everything following the single switch char, or everything after = in a LongSwitch ' APosition Which value on the command line this matched ' AFollowing Value of next parameter on the command line ' Returns true if the parameter was found Dim Found Dim c1 Dim count Dim args Dim ASign Set args = WScript.Arguments Found = False c1 = AStartAt count = args.count While Not found And c1 < count If (Left(args(c1),2)) = "--" Then If UCase(Mid(args(c1),3,Len(ALongSwitch))) = (UCase(ALongSwitch)) Then Found = True ASign = InStr(args(c1),"=") If ASign <> 0 Then AAssigned = Mid(args(c1),ASign+1,Len(args(c1))) Else AAssigned = "" End If End If ElseIf (Left(args(c1),1)) = "-" Then If AMatchCase = True Then ' make sure it matches If Mid(args(c1),2,1) = ASingleSwitch Then found = True APosition = c1 AAssigned = Mid(args(c1),3,Len(args(c1))) If (c1 < count+1) Then AFollowing = args(c1+1) End If Else ' we don't care about case If UCase(Mid(args(c1),2,1)) = UCase(ASingleSwitch) Then found = True APosition = c1 AAssigned = Mid(args(c1),3,Len(args(c1))) End If End If End If AFollowing = "" If Found And (c1 < count-1) Then AFollowing = args(c1+1) End If c1 = c1 + 1 Wend CmdLineParam = Found End Function
How To Make Administrator Appear in XP
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionWinlogonSpecialAccountsUserList] "Administrator"=dword:00000001
Arreglar los archivos NTLDR en Windows
copy D:i386ntldr C: copy D:i386ntdetect.com C:
Accessing windows registry in Java
import java.lang.reflect.Method;
import java.util.prefs.Preferences;
public class JavaRegistryHack {
private static final int HKEY_CURRENT_USER = 0x80000001;
private static final int KEY_QUERY_VALUE = 1;
private static final int KEY_SET_VALUE = 2;
private static final int KEY_READ = 0x20019;
public static void main(String args[]) {
final Preferences userRoot = Preferences.userRoot();
final Preferences systemRoot = Preferences.systemRoot();
final Class clz = userRoot.getClass();
try {
final Method openKey = clz.getDeclaredMethod("openKey",
byte[].class, int.class, int.class);
openKey.setAccessible(true);
final Method closeKey = clz.getDeclaredMethod("closeKey",
int.class);
closeKey.setAccessible(true);
final Method winRegQueryValue = clz.getDeclaredMethod(
"WindowsRegQueryValueEx", int.class, byte[].class);
winRegQueryValue.setAccessible(true);
final Method winRegEnumValue = clz.getDeclaredMethod(
"WindowsRegEnumValue1", int.class, int.class, int.class);
winRegEnumValue.setAccessible(true);
final Method winRegQueryInfo = clz.getDeclaredMethod(
"WindowsRegQueryInfoKey1", int.class);
winRegQueryInfo.setAccessible(true);
byte[] valb = null;
String vals = null;
String key = null;
Integer handle = -1;
//Query Internet Settings for Proxy
key = "SoftwareMicrosoftWindowsCurrentVersionInternet Settings";
handle = (Integer) openKey.invoke(userRoot, toCstr(key), KEY_READ, KEY_READ);
valb = (byte[]) winRegQueryValue.invoke(userRoot, handle.intValue(),
toCstr("ProxyServer"));
vals = (valb != null ? new String(valb).trim() : null);
System.out.println("Proxy Server = " + vals);
closeKey.invoke(Preferences.userRoot(), handle);
// Query for IE version
key = "SOFTWAREMicrosoftInternet Explorer";
handle = (Integer) openKey.invoke(systemRoot, toCstr(key), KEY_READ, KEY_READ);
valb = (byte[]) winRegQueryValue.invoke(systemRoot, handle, toCstr("Version"));
vals = (valb != null ? new String(valb).trim() : null);
System.out.println("Internet Explorer Version = " + vals);
closeKey.invoke(Preferences.systemRoot(), handle);
} catch (Exception e) {
e.printStackTrace();
}
}
private static byte[] toCstr(String str) {
byte[] result = new byte[str.length() + 1];
for (int i = 0; i < str.length(); i++) {
result[i] = (byte) str.charAt(i);
}
result[str.length()] = 0;
return result;
}
Windows Computer Management Desktop Shortcut
%SystemRoot%system32compmgmt.msc /s gpedit.msc msconfig "F:Program FilesMozilla Firefoxfirefox.exe" -turbo -profile "C:homeichEigeneDateienRohdatenFirefoxEntwicklung" -no-remote
rename file with to current date
ren test.txt test%date:~4,2%-%date:~7,2%-%date:~10%.txt
Delete all the Thumbs.db files on your drive
del /s /q Thumbs.db
.bat file that calls a script and passes arguments to the script
%~dp$PATH:1FOO.pl %*
Category: Uncategorized |
Tags: bat, batch, batchfile, environment, name, os, parameters, path, scripting, windows, wrapper