How to test if a file is a directory in a batch script?

This works: if exist %1\* echo Directory Works with directory names that contains spaces: C:\>if exist “c:\Program Files\*” echo Directory Directory Note that the quotes are necessary if the directory contains spaces: C:\>if exist c:\Program Files\* echo Directory Can also be expressed as: C:\>SET D=”C:\Program Files” C:\>if exist %D%\* echo Directory Directory This is safe … Read more

How to delete empty folders using windows command prompt?

You can use the ROBOCOPY command. It is very simple and can also be used to delete empty folders inside large hierarchy. ROBOCOPY folder1 folder1 /S /MOVE Here both source and destination are folder1, as you only need to delete empty folders, instead of moving other(required) files to different folder. /S option is to skip … Read more

How to stop java process gracefully?

Shutdown hooks execute in all cases where the VM is not forcibly killed. So, if you were to issue a “standard” kill (SIGTERM from a kill command) then they will execute. Similarly, they will execute after calling System.exit(int). However a hard kill (kill -9 or kill -SIGKILL) then they won’t execute. Similarly (and obviously) they … Read more

generates same number in Linux, but not in Windows

Here’s what’s going on: default_random_engine in libstdc++ (GCC’s standard library) is minstd_rand0, which is a simple linear congruential engine: typedef linear_congruential_engine<uint_fast32_t, 16807, 0, 2147483647> minstd_rand0; The way this engine generates random numbers is xi+1 = (16807xi + 0) mod 2147483647. Therefore, if the seeds are different by 1, then most of the time the first … Read more

Visual Studio Code install location

Update 10.11.2018 If you do a complete re-install, including uninstalling prior versions of code installed on your machine the new version will be installed at C:\Users\{UserName}\AppData\Local\Programs\Microsoft VS Code Update 06.07.2018 Since Version 1.25 VS Code supports portable mode. Instructions on how to use this are documented here. You will need the ZIP file download version … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)