Shadow space example

The shadow space must be provided directly previous to the call. Imagine the shadow space as a relic from the old stdcall/cdecl convention: For WriteFile you needed five pushes. The shadow space stands for the last four pushes (the first four arguments). Now you need four registers, the shadow space (just the space, contents don’t … Read more

Split %date% in a batch file regardless of Regional Settings

Four years have passed, but this question doesn’t get old, and I think now there’s a slightly better answer than using wmic (on win7 onwards). for /F “tokens=1,2,3 delims=_” %%i in (‘PowerShell -Command “& {Get-Date -format “MM_dd_yyyy”}”‘) do ( set MONTH=%%i set DAY=%%j set YEAR=%%k ) echo %MONTH% %DAY% %YEAR% With powershell Get-Date you can … Read more

How to expand a CMD shell variable twice (recursively)

Thinking in terms of a less tortuous solution, this, too, produces the CCC you desire. setlocal enabledelayedexpansion set AAA=BBB set BBB=CCC for /F %%a in (‘echo %AAA%’) do echo !%%a! edit: to dissect this answer: setlocal enabledelayedexpansion – this will allow for any environment variable setting during your bat to be used as modified during … Read more

Can I set an environment variable for an application using a shortcut in Windows?

As explained here: http://www.labs64.com/blog/2012/06/set-environment-variables-in-windows-shortcut/ you can do it without a bat file too. Set Target to e.g.: C:\Windows\System32\cmd.exe /c “SET path=%path%&& START /D ^”C:\Program Files (x86)\Notepad++^” notepad++.exe” To avoid see the command prompt for a split second before it close again, you should set Run: Minimized on the Shortcut tab (Tested on Windows 7, Windows … Read more

How to change the build type to Release mode in cmake?

To change the build type, on Windows, it must be done at build time: cmake –build {DIR} –config Release By default it’s Debug. I’m still looking for a way of changing this default. CMAKE_BUILD_TYPE doesn’t work of course, and tweaking CMAKE_CONFIGURATION_TYPES doesn’t work either, obviously for the same reason, they only apply for Unix makefiles, … Read more

How to replace crlf with lf in a single file

The git installation on windows usually includes the dos2unix tool. dos2unix <file> But in your case you should use .gitattributes to prevent the file from being converted on windows. A .gitattributes file can look like this *.vcproj eol=crlf *.sh eol=lf From the .gitattributes documentation Set to string value “lf” This setting forces Git to normalize … Read more