Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: What is the Windows equivalent to the UNIX CAT command?

15 Mar 2012   #1
Golden

Microsoft Community Contributor Award Recipient

Windows 7 Ult. x64
 
 
What is the Windows equivalent to the UNIX CAT command?

G'day,

Can someone suggest the Windows equivalent of the following UNIX usage of CAT?

In UNIX:

Code:
set i = 1
cat << EOF > input.txt
+ var_${i} 0 byte Variable 1
+ spc_${i} 0 byte Variable 2
+ arq_${i} 0 integer Variable 3
EOF
results in a file called input.txt, that when opened looks like this:

Code:
+ var_1 0 byte Variable 1
+ spc_1 0 byte Variable 2
+ arq_1 0 integer Variable 3
I'm trying to achieve the same thing in a .BAT file using the Windows cmd shell, but I'm unsure of the appropriate command and syntax. Can someone offer any pointers?

Thanks,
Golden


My System SpecsSystem Spec
.

15 Mar 2012   #2
GEWB

32bit: XP, Win7 H.P. / 64bit: 2008R2, Win7 Pro, Ultimate / Win8.1 / Several flavors of Linux
 
 

Closest I could remember from DOS is "type" with "+" (haven't used this in 15 years!).

From Wikipedia:
The equivalent command in the VMS, CP/M, DOS, OS/2, and Microsoft Windows operating system command shells is type.
Note: To combine multiple files together in DOS/Windows you can use the "copy /b" command:
Example:
copy /b file1.txt + file2.txt file3.txt


This copies file1.txt and file2.txt in binary mode together in one file, file3.txt.


Regards,
GEWB
My System SpecsSystem Spec
15 Mar 2012   #3
strollin

W7 Ult desktop, W8.1 laptop, W7 Home netbook, W8.1 tablet, Win 10 TP VM
 
 

Pretty simple, really.

Code:
set i=1
echo + var_%i% 0 byte Variable 1 > input.txt
echo + spc_%i% 0 byte Variable 2 >> input.txt
echo + arq_%i% 0 byte integer Variable 3 >> input.txt
When outputting to a file from a .BAT file, a single ">" indicates to create a new file while a double ">>" indicates to concatenate to an existing file.
My System SpecsSystem Spec
.


15 Mar 2012   #4
GEWB

32bit: XP, Win7 H.P. / 64bit: 2008R2, Win7 Pro, Ultimate / Win8.1 / Several flavors of Linux
 
 

+1 ^^^^^
(I forgot that one!)

Regards,
GEWB
My System SpecsSystem Spec
16 Mar 2012   #5
Golden

Microsoft Community Contributor Award Recipient

Windows 7 Ult. x64
 
 

Sorted. Thanks fellas
My System SpecsSystem Spec
Reply

 What is the Windows equivalent to the UNIX CAT command?




Thread Tools





Similar help and support threads
Thread Forum
Linux/UNIX Commands in Windows CLI?
Is there any program(s) I could install to allow use of various commands I'm used to using in Linux in the Windows command prompt?
Software
What has Linux and UNIX to do with D-Link DNS-320 and a Windows 7 comp
I have a problem accessing files on my D-Link DNS-320 from my desktop Windows 7 Professional, Service Pack 1, 64 bits. My WLAN consists of two laptops with Windows XP SP 3 and a desktop with Windows 7 Professional, 64 bits. All three are members of the same work group and are visible to...
Network & Sharing
SAMBA share windows 7 and HP Unix
I am new to windows 7 and need my samba share to work. I have been sharing from HP Unix using samba to windows XP for a while. I loaded windows 7 prof - 64 bit on a machine and I cannot get the samba share to work. I have change the lmcompatabilitylevel from 1 to 2. I changed the policy...
Network & Sharing
Microsoft Windows Server OS vs Linux/Unix
This came in to thought of mine. Now i know this is probably not related about anything with Windows 7 but i just thought i might ask. What are the comparisons between the two and what are the differences? Both operating systems deal with networking and workgroups along with clients and work...
Software
Windows 7 UNIX Free Resources Available for Download.
Source - Windows 7 UNIX Free Resources Available for Download - From Microsoft - Softpedia
News
Kerberos Authentication to UNIX from Windows 7 OS
Hi, I am testing Windows 7 OS in our domain and found that Kerberos authentication to UNIX domain from Windows 7 is not working. It is prompting for a password everytime I connect to a unix host and not going throuh pass-through authentication. This works perfectly fine on Windows XP OS in our...
System Security

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 04:43.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App