Реализация команды «cat» в консоли Windows
В общем задание следующее: В консоли Linux есть команда «cat», аналог которой надо сделать под консоль Windows на языке C++. В идеале требуется реализация посредством WinAPI, но можно и иначе. Шарил в сети код, но ничего толкового не нашел, а лишь это .
Реализация UNIX команды «cat» в консоли Windows с использованием WinAPI
В консоли Linux есть команда «cat», аналог которой надо сделать под консоль Windows на языке C++.
Реализация команды «tail» на Windows на языке C++
В общем задание следующее: В консоли Linux есть команда «tail», аналог которой надо сделать под.
Что означают команды «fun», «my_max», «my_min» в C++?
Мне нужно защищать программу, а я писал её не сам, и в универе мы эти команды ещё не проходили, и.
Вы бы хоть заданием поинтересовались.
google -> «unix cat» -> читать первую ссылку на википедию -> посмотреть примеры работы утилиты -> посмотреть на код -> понять что, вау, оно вроде делает что надо -> подогнать под винду
Заказываю контрольные, курсовые, дипломные и любые другие студенческие работы здесь или здесь.
Для каждой строки найти слова, которые не имеют ни одного из букв: «l», «k», «r», «s» i «j»
Задано символьные строки. Строка состоит из нескольких слов (наборов символов), которые разделяются.
Как можно заменить все слова «fox» на «cat» ?
Привет Нашел пример замены слова. А как можно заменить все слова «fox» на «cat» Function.
Реализация команды «Сохранить» в блокноте
Создаю блокнот в С#, дошёл до «сохранить» и «сохранить как. » «Сохранить как. » сделал, а просто.
Is there replacement for cat on Windows
I need to join two binary files with a *.bat script on Windows.
How can I achieve that?
11 Answers 11
Windows type command works similarly to UNIX cat .
Example 1:
is equivalent of:
Example 2:
This command will merge all the vcards into one.
You can use copy /b like this:
If you have control over the machine where you’re doing your work, I highly recommend installing GnuWin32. Just «Download All» and let the wget program retrieve all the packages. You will then have access to cat, grep, find, gzip, tar, less, and hundreds of others.
GnuWin32 is one of the first things I install on a new Windows box.
600 kB exe incorporating
30 Unix utilities. The only difference is that one should use «busybox cat» command instead of simple «cat» – Fr0sT Jan 10 ’14 at 13:59
Shameless PowerShell plug (because I think the learning curve is a pain, so teaching something at any opportunity can help)
Note that type is an alias for Get-Content, so if you like it better, you can write:
Just use the dos copy command with multiple source files and one destination file.
You might need the /B option for binary files
In Windows 10’s Redstone 1 release, the Windows added a real Linux subsystem for the NTOS kernel. I think originally it was intended to support Android apps, and maybe docker type scenarios. Microsoft partnered with Canonical and added an actual native bash shell. Also, you can use the apt package manager to get many Ubuntu packages. For example, you can do apt-get gcc to install the GCC tool chain as you would on a Linux box.
If such a thing existed while I was in university, I think I could have done most of my Unix programming assignments in the native Windows bash shell.
If you simply want to append text to the end of existing file, you can use the >> pipe. ex:
If you have to use a batch script and have python installed here is a polygot answer in batch and python:
If saved as join.bat usage would be:
Thanks too this answer for the inspiration.
I try to rejoin tar archive which has been splitted in a Linux server.
Windows batch — concatenate multiple text files into one
I need to create a script, which concatenates multiple text files into one. I know it’s simple to use
But the requirement is to «concatenate files from same day into file day_YYYY-DD-MM.txt» I am a Linux user and Windows batch is hell for me. It’s Windows XP.
9 Answers 9
Windows type command works similarly to UNIX cat .
Example 1: Merge with file names (This will merge file1.csv & file2.csv to create concat.csv)
Example 2: Merge files with pattern (This will merge all files with csv extension and create concat.csv)
When using asterisk(*) to concatenate all files. Please DON’T use same extension for target file(Eg. .csv). There should be some difference in pattern else target file will also be considered in concatenation
At its most basic, concatenating files from a batch file is done with ‘copy’.
Place all files need to copied in a separate folder, for ease place them in c drive.
Open Command Prompt — windows>type cmd>select command prompt.
You can see the default directory pointing — Ex : C:[Folder_Name]>. Change the directory to point to the folder which you have placed files to be copied, using ‘ cd [Folder_Name] ‘ command.
After pointing to directory — type ‘dir’ which shows all the files present in folder, just to make sure everything at place.
Now type : ‘copy *.txt [newfile_name].txt’ and press enter.
All the text in individual files will be copied to [newfile_name].txt
Windows cmd cat file
345515 просмотра
9 ответа
Мне нужно объединить два бинарных файла со *.bat сценарием в Windows.
Как я могу это достичь?
Ответы (9)
403 плюса
type Команда Windows работает аналогично UNIX cat .
Пример 1:
Пример 2:
Эта команда объединит все виртуальные карты в одну.
77 плюса
Вы можете использовать copy /b вот так:
21 плюса
Если у вас есть контроль над машиной, на которой вы работаете, я настоятельно рекомендую установить GnuWin32 . Просто «Загрузить все» и пусть программа wget загрузит все пакеты. Затем у вас будет доступ к cat, grep, find, gzip, tar, less и сотням других.
GnuWin32 — одна из первых вещей, которые я устанавливаю в новом окне Windows.
11 плюса
Бесстыдный штепсель PowerShell (потому что я думаю, что кривая обучения — боль, поэтому обучение чему-то при любой возможности может помочь)
Обратите внимание, что type это псевдоним для Get-Content, поэтому, если вам это нравится, вы можете написать:
3 плюса
Просто используйте команду dos copy с несколькими исходными файлами и одним целевым файлом.
copy file1 + file2 appendedfile
Вам может понадобиться опция / B для двоичных файлов
Автор: simon Размещён: 13.09.2008 01:32
2 плюса
В выпуске Redstone 1 от Windows 10 Windows добавила настоящую подсистему Linux для ядра NTOS. Я думаю, что первоначально он предназначался для поддержки приложений Android и, возможно, сценариев типа докеров. Microsoft сотрудничала с Canonical и добавила фактическую собственную оболочку bash. Кроме того, вы можете использовать менеджер пакетов apt для получения множества пакетов Ubuntu. Например, вы можете сделать apt-get gcc для установки цепочки инструментов GCC, как и в ящике Linux.
Если такая вещь существовала, когда я учился в университете, я думаю, что мог бы выполнить большинство моих назначений программирования Unix в родной оболочке Windows bash.
Автор: sam msft Размещён: 17.05.2016 08:15
1 плюс
Если вы просто хотите добавить текст в конец существующего файла, вы можете использовать >> pipe. например:
Автор: Jahmic Размещён: 30.05.2014 03:49
0 плюса
Если вам нужно использовать пакетный скрипт и установить python здесь, это полигонный ответ в пакетном и python:
Если сохранение в качестве соединения join.bat будет:
Спасибо тоже этот ответ за вдохновение.
Автор: Noelkd Размещён: 15.10.2014 01:40
0 плюса
Я пытаюсь подключиться к архиву tar, который был разделен на сервере Linux.
How to do a simple file search in cmd
I want to quickly search for a file given its name or part of its name, from the windows command line (not power shell). This is similar to opening explorer and using the search box at the top.
Note: dir can search based on a string template but it will not search in the subdirectories.
Note2: findstr can be used to search for a token inside files and has a recursivity flag; it’s funny that a more complex find can be easily discovered .
5 Answers 5
dir /s *foo* searches in current folder and sub folders.
It finds directories as well as files.
/s Lists every occurrence of the specified file name within the specified directory and all subdirectories.
searches for all txt file in the directory tree. Before using it just change the directory to root using
you can also export the list to a text file using
and search within using
EDIT 1: Although this dir command works since the old dos days but Win7 added something new called Where
will search for exe & dll in the drive c:\Windows as suggested by @SPottuit you can also copy the output to the clipboard with
just wait for the prompt to return and don’t copy anything until then.
EDIT 2: If you are searching recursively and the output is big you can always use more to enable paging, it will show — More — at the bottom and will scroll to the next page once you press SPACE or moves line by line on pressing ENTER