How can I create an empty file at the command line in Windows?

Without redirection, Luc Vu or Erik Konstantopoulos point out to: copy NUL EMptyFile.txt copy /b NUL EmptyFile.txt “How to create empty text file from a batch file?” (2008) also points to: type NUL > EmptyFile.txt # also echo. 2>EmptyFile.txt copy nul file.txt > nul # also in qid’s answer below REM. > empty.file fsutil file … Read more

Install an apk file from command prompt?

You can use the code below to install application from command line adb install example.apk this apk is installed in the internal memory of current opened emulator. adb install -s example.apk this apk is installed in the sd-card of current opened emulator. You can also install an apk to specific device in connected device list … Read more

How do I get current date/time on the Windows command line in a suitable format for usage in a file/folder name?

See Windows Batch File (.bat) to get current date in MMDDYYYY format: @echo off For /f “tokens=2-4 delims=/ ” %%a in (‘date /t’) do (set mydate=%%c-%%a-%%b) For /f “tokens=1-2 delims=/:” %%a in (‘time /t’) do (set mytime=%%a%%b) echo %mydate%_%mytime% If you prefer the time in 24 hour/military format, you can replace the second FOR line … Read more

How do I measure execution time of a command on the Windows command line?

PowerShell has a cmdlet for this called Measure-Command. You’ll have to ensure that PowerShell is available on the machine that runs it. PS> Measure-Command { echo hi } Days : 0 Hours : 0 Minutes : 0 Seconds : 0 Milliseconds : 0 Ticks : 1318 TotalDays : 1.52546296296296E-09 TotalHours : 3.66111111111111E-08 TotalMinutes : 2.19666666666667E-06 … Read more

“rm -rf” equivalent for Windows?

RMDIR or RD if you are using the classic Command Prompt (cmd.exe): rd /s /q “path” RMDIR [/S] [/Q] [drive:]path RD [/S] [/Q] [drive:]path /S Removes all directories and files in the specified directory in addition to the directory itself. Used to remove a directory tree. /Q Quiet mode, do not ask if ok to … Read more

Batch file to delete files older than N days

Enjoy: forfiles -p “C:\what\ever” -s -m *.* -d <number of days> -c “cmd /c del @path” See forfiles documentation for more details. For more goodies, refer to An A-Z Index of the Windows XP command line. If you don’t have forfiles installed on your machine, copy it from any Windows Server 2003 to your Windows XP machine at %WinDir%\system32\. … Read more

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