Saved Bookmarks
| 1. |
Solve : Echo command? |
|
Answer» HI, I have a question about Echo. I have read about what it is and what it is USED for ,but did not really help me to understand what the following line mean. Cananyona help please? echo .> D:\Projects\logs\WinScpFtp_log.txt What I cant find on the web is what these characters mean .> Does this mean that it puts in the file WinScpFtp_log.txt a dot? Thanks Yes but it also overwrites that file if it already exists. If you need to append to the log file then you would use two > You are physically echoing a period and redirecting the output to the log file.This: (with a space between echo and the dot!) echo . > path\filename echoes a dot and a newline (cr + lf) to the file, creating the file if it does not exist, overwriting the file completely if it already exists. Note however: This: (no space between the echo and the dot!) echo. > path\filename echoes a blank new line to the file. Redirection operators: > create new file if it does not exist, over-write file if it exists. >> create new file if it does not exist, append to file (add to end of file if it exists. Quote from: Suhi100 on February 11, 2015, 11:31:40 AM What I cant find on the web is what these characters mean .> Examples of many guides: (1) http://ss64.com/nt/syntax-redirection.html (2) http://ss64.com/nt/echo.html General help: http://ss64.com/nt/ http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds.mspx?mfr=true Or type cmd syntax into Google Also, because DOS batch was not intended as a learning language for those new to computer programming. If you look for information about computer languages, batch is seldom, if ever, LISTED as suitable for newcomers. Instead you might see: Quote Assembly (a relatively simple dialect)To be sure, there are excellent tutorials for batch. As was mentioned by Salmon Trout above. But you have to read them. Well said Salmon Trout. I visit SS64 and Rob Vanderwoude's site as well. http://www.robvanderwoude.com/redirection.php Quote from: Salmon Trout on February 11, 2015, 12:58:29 PM This: Just idly commenting here that your examples also add spaces. Quote from: foxidrive on February 12, 2015, 07:45:42 AM Just idly commenting here that your examples also add spaces. You know, I was on the bus coming back from work, and I thought "I put spaces before the redirections". Correction: This: (with a space between echo and the dot!) echo .> path\filename echoes a dot and a newline (cr + lf) to the file, creating the file if it does not exist, overwriting the file completely if it already exists. Note however: This: (no space between the echo and the dot!) echo.> path\filename echoes a blank new line to the file. Redirection operators: > create new file if it does not exist, over-write file if it exists. >> create new file if it does not exist, append to file (add to end of file if it exists. [/quote] |
|