Tag Info

Hot answers tagged

12

The standard Windows command shell — cmd.exe — doesn't use the << operator at all. A single < means "read file into standard input" to cmd.exe, but two < characters back-to-back is meaningless to cmd.exe, so it gives the error you got. The << operator is meaningful to all major types of Unix command shell, where it is used for here ...


5

Using ExifTool (portable executable renamed to exiftool.exe): exiftool -ImageSize -r . Here ImageSize is the tag name you're interested in and will print Image Width x Image Height. The -r switch makes it recursively process files in subdirectories. Custom output string format is simple as well. For example: exiftool -p "Image Name: \"$FileName\"$/Image ...


4

It's because when you save a Text file in Visual Studio it saves it in UTF-8 encoding, including a byte order mark (BOM) at the beginning. Since the command-line's default code page isn't UTF-8, you see the characters. You can set the command-line to support UTF-8 by issuing the command chcp 65001, but for compatibility sake you're best off ensuring your ...


4

There is > and >> but only <, there is no << command < filename Type a text file and pass the text to command Source: http://ss64.com/nt/syntax-redirection.html


2

You can do something like this, using convert from package imagemagick, putting new files in /tmp/new or a similar directory: mkdir /tmp/new find . -iname '*.jpg' | while read file do convert -resize '>3000x>3000' "$file" /tmp/new/"$file" touch -r "$file" /tmp/new/"$file" done If happy with the result, move them with: rsync -a /tmp/new/ . rm -fr ...


2

> writes to a NEW file. >> appends to a file < reads from a file | sends a commands output into another command's input See here for a list Is typing %^ into cmd.exe a Windows easter egg? Since that was posted this has been added. Starting a Program =============== See start /? and call /? for help on all three ways. Specify a program ...


2

Even if your second script will work, this one is simpler to understand, and written in 'better PowerShell' : $currentfolder = Get-Location Get-ChildItem - path $currentfolder -File -Include folder.jpg,albumart*.jpg,desktop.ini -Recurse | Remove-Item -Force -Verbose Hope this helps !


2

There might be serious problems in the near future. Confusingly enough, SysWOW64 holds 32-bit DLLs for use by 32-bit applications that you run, while the System32 folder has 64-bit binaries. DLL files that are in use or already exist were not replaced, but there are probably a bunch of 64-bit DLLs that are in a folder where only 32-bit binaries are ...


2

@echo off cd C:\script\ for /f "tokens=3" %%i in ('find /C "ANR2034E" checkout.txt') do ( echo %%i if [%%i]==[1] ( echo %%i ) else ( echo No ) ) The error was because you had /i after the if within square brackets. In any case /i (case insensitivity) is not required because you've used find /c which will return only an ...


2

Linux This should work: for pfx in $(for i in *.foo; do echo "${i%%[.(]*}"; done | sort -u); do 7z a "$pfx.7z" $pfx[.\(]*; done Explanation First we have to iterate all over the input files (*.foo) and strip away the suffix (${i%%[.(]*}) obtaining: file_123 file_123 file_123 foobar foobar foobar Then we can remove duplicates with sort -u: file_123 ...


2

Try this instead: for /f "tokens=1*" %%a in ('schtasks /query /fo list ^| findstr /r "TaskName.*Adobe"') do schtasks /delete /tn "%%b" /f The findstr portion uses regex (regular expressions) to extract only the lines containing the strings "TaskName" and "Adobe" from the output of schtasks. This is then tokenised by for /f (see for /? for more) and the ...


2

Your question is not very clear but the following will do what you seem to be asking: echo "line1" > options.txt echo "line2" >> options.txt echo "jack.hales" >> options.txt


1

Maybe this is easier: >options.txt ( line1 line2 line-x blabla )


1

Never mind folks, the answer was deceptively simple, I do smack myself over the head sometimes. : Get path of parent folder (relative) for %%B in (%~dp0\.) do set APPPATH=%%~dpB To: : Get path of parent folder (relative) for %%B in ("%~dp0\.") do set APPPATH=%%~dpB (encapsulate the path with quotes) Problem solved (Gah!)


1

If there are always 4 lines as shown with "TRAILER" in the last line: for /f "skip=3 tokens=2 delims=|" %l in (List.txt) do @echo %l If there can be any number of lines with the "TRAILER" line being present anywhere: for /f "tokens=2 delims=|" %l in ('type List.txt ^| find "TRAILER"') do @echo %l for /? will teach you what the skip, tokens and delims ...


1

There a PowerShell script below that should do it; just change the directories for list and output. I tested under Windows 8.1 and Windows PowerShellISE. param( $folder = "E:\My Pictures", $outputFile = "E:\details.txt" ) $objShell = New-Object -ComObject Shell.Application $fileList = @() $attrList = @{} $details = ( "Dimensions" ) $objFolder = ...


1

Ok solution with ImageMagick, simple and quick (but ofc requires the library). Open the cmd line in the folder you are interested (Shift+RightClick inside your folder window and select "Open command window here"), then in the cmd prompt use this identify -format "%f %wx%h\r" *.jpg > info.txt Calls for %f filename, %w width and %h height formatted like ...


1

You probably need to the change the work directory in the batch before starting the executable. Check the start directory in the shortcut and then add a cd to this location as first line in the batch file. Else it will likely end up starting the executable with your user profile directory or windows\system32 as working directory which can cause problems ...


1

counters.dat is visible for me: C:\Users\DavidPostill\AppData\Local\Microsoft\Windows\Temporary Internet Files>dir /a Volume in drive C has no label. Volume Serial Number is C8D0-DF1E Directory of C:\Users\DavidPostill\AppData\Local\Microsoft\Windows\Temporary Internet Files 10/06/2015 21:29 <DIR> . 10/06/2015 21:29 ...


1

If all of the files really are valid CSV, then amending the last line to loop over the files in the current folder using variable %H, change the copy to: TYPE %H >>new.csv Should work (not fully tested I'm afraid). However, a better approach would be to use PowerShell since that has cmdlets to handle CSV input and output and so it would be able to ...


1

Windows native job scheduler is not configured the same way as Unix/Linux cron, You cannot change the scheduling by editing the contents of a batch file. You have limited options in the Task scheduler You could alter that batch file to exit early if the time of day is outside a specific range. An answer in stackoverflow suggests set ...


1

If your example is accurate, you may not be creating something that Excel really can make sense of. I would recommend trying to put a row containing headings as the first row to see if that helps. Also check your line endings to make sure you are adding \r\n (e.g. Windows line endings) rather than just \n - Excel should cope with the later but it can be ...


1

From a batch script: set "counter=0" set "file=" for %%i in (*.reg) do ( set /A "counter+=1" set "file=%%~i" ) if %counter% EQU 1 ( regedit /s "%file%" ) else ( goto :error ) Read more in An A-Z Index of the Windows CMD command line


1

Here is a much simpler way to do what you want (in a one line command): ping 10.18.89.154 | findstr "Packets" > c:\pinglog.txt The above command will work as is from the command line or from a batch file. test.cmd (using google.com as I can't ping something on your network with a private IP address): ping www.google.com | findstr "Packets" > ...


1

If they weren't named after system files it will be ok as noting will try to use them. If they were named after system files, as is likely, they will all Access Deny as noone has access to overwrite system files including administrators. C:\Users\User>icacls c:\windows\system32\notepad.exe c:\windows\system32\notepad.exe NT SERVICE\TrustedInstaller:(F) ...


1

Batch interpreter parses command line in slightly different manner than pure command line parser (read answers to another question at StackOverflow): command line: to avoid expanding %MYAPPSDIR% by command line interpreter, the % percent character should be escaped by the standard CLI escape character (^ caret): ^%MYAPPSDIR^% or ^%1; .bat script: to avoid ...


1

Kindly refer to the solution here I am posting that solution again @echo off set f1=1.txt set f2=2.txt set "sep= " % tab % ( for /f "delims=" %%a in (%f2%) do ( setlocal enabledelayedexpansion set /p line= echo(!line!!sep!%%a endlocal ) )<%f1%


1

The Start verb will open cmd in a new window. This works for me in a .bat: start cmd /K PROMPT $t$gEnter Command Here$g the /K will keep the cmd window open after running the prompt command, so you can use the shell. Just save it in a batch file, and invoke by double-click or in another command window.



Only top voted, non community-wiki answers of a minimum length are eligible