How to view a CSV file in a windows command prompt itself? - csv

The linux command for viewing csv file in terminal is:
cat filename.csv
What i use in a windows command prompt for the same thing
I can open the csv file in excel through cmd but i can't view it in the cmd.
I searched a lot and couldn't get..

For simply viewing a file, use the more command for better control, and it works on both Linux and Windows.

In Windows, in the command prompt you can simply use the type syntax to display the csv file content:
c:\>type [filename.csv]

Related

remove the first line of a csv file under windows using cmd command

I need to remove the first line of a csv file under
windows
using
cmd
command
The file size is around 1GB
Using CMD for such large file sizes is not the most efficient.
Also, there is no direct command that lets us edit files on the go (such as vi in linux).
You can, however, exclude the first X lines from a file & copy it to a new file using:
more +X [file_containing data] > [file_to_export_data_to]
Source: Extract N lines from file using single windows command

mysql is not recognised as an inter or external command

I have installed xampp in c: drive.
I am able to run my sql from xampp,
but when I am trying to open it from cmd prompt its giving following error. Please help
C:\xampp\mysql\bin>mysql.ece 'mysql.ece' is not recognized as an
internal or external command, operable program or batch file.
I am not familiar with a MySQL command being called mysql.ece.
Should it be mysql.exe instead?
change mysql.ece to mysql.exe, you will see a file with mysql.exe in bin folder which is inside mysql folder.

Command Line Printing - Adobe Reader and GhostScript

I am trying to use command line printing for some of my reports created using SSRS to a network printer.
Not able to get any successful results, after some testing on Windows command prompt. Without any error message given, I have no idea whether I am heading the right way or not.
Using Adobe Reader
Not working
C:\>"C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe" /t "e:\temp\1.pdf" \\printserver\myprinter
but when I try to use Adobe, open the file and print manually, it works.
Using GhostScript
Not working
C:\>"C:\Program Files\gs\gs9.18\bin\gswin64.exe" -dPrinted -dBatch -sOutputFile="\\\printserver\myprinter" "e:\temp\1.pdf"
Do I need to install network printer driver on my server ? or my command line is incorrect ?
Thanks ...

Running MySQL from Windows 7 command line

I want to run a brief MySQL script from the Windows 7 command line. The command line text I am using looks like:
C:\> C:\my path\mysql\bin\mysqld-nt --init-file=C:\\mysql-script.txt
The problem is that I am getting the following error message in the Windows 7 command line:
C:\my is not recognized as an internal or external command, operable program or batch file
I have researched this online, but the solutions center around setting a new Windows environmental variable. I do not think I should create an environmental variable called 'my'. So what else can I do in order to run mysqld-nt from the Windows 7 command line?
It is important that MySQL not be running when I do this, so I need to call it from the Windows 7 command line and not use the MySQL command line client.
You have a space between "my" and "path".
Try:
"C:\my path\mysql\bin\mysqld-nt" --init-file=C:\\mysql-script.txt
You need the quotes to wrap any directory structure containing a space.
The answer is right in the error:
C:\my is not recognized as an internal or external command, operable
program or batch file
What is C:\my path? Is that really your file system path?
If so, your command would be; note the quotes to keep "my path" together:
"C:\my path\mysql\bin\mysqld-nt" --init-file=C:\\mysql-script.txt
But more likely, my path should be the actual file system path on your Windows 7 install.

Windows: How to open a .exe in a shell window that won't close?

I've had this problem for ages, and it's SO ANNOYING.
Suppose I want to run mysqldump.exe... here's my process: Start->run, type "cmd" ... dir into directory after directory until I finally get to c:/program files/mysql/bin/then I can FINALLY call "mysqldump.exe"
I don't mind using Windows Explorer to get to c:/program files/mysql/bin, but then I can't freaking open up any of the .exe files in a shell, and I can't open up shell with the directory being that one.
How can I do this?
This is what I do for those type of commands:
Drag a copy of the "Command Prompt" shortcut onto your desktop.
Open the properties of the shortcut.
Change the Target: field to: %SystemRoot%\system32\cmd.exe /k mysqldump.exe
Change the Start in: field to: c:/program files/mysql/bin/
Hit Ok, then rename the short cut from "Command Prompt" to "Mysqldump".
Then just double click the icon whenever you need that command. The "/k" option for cmd.exe leaves the window open.
Microsoft released a powertoy for Windows XP called Open Command Prompt Here. If you're using Vista, all you need to do is hold shift and right-click.
here's my process: Start->run, type
"cmd" ... dir into directory after
directory until I finally get to
c:/program files/mysql/bin/ then I can
FINALLY call "mysqldump.exe"
Why not just the following?
c:
cd "c:/program files/mysql/bin"
mysqldump.exe
Better yet, put this in a batch file and execute it.
You can also create a shortcut for cmd.exe and set the "Start in" directory to "c:/program files/mysql/bin".
You can download an add-in so that you can right click on the folder and open a command prompt. Saves a lot of time and you say you dont mind navigating to the location.
http://download.microsoft.com/download/whistler/Install/2/WXP/EN-US/CmdHerePowertoySetup.exe
A nice little trick is that the icon in the adress bar of explorer could be dragged to a command line window and it insert the full path at your current cursor position.
It doesn't work in vista but if you SHIFT-RightClick on a folder you have an "Open Command Windows Here" option that appears.
Under xp you could have it by saving this as a .reg and executing it :
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\cmd]
#="Open Command Prompt Here"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\cmd\command]
#="cmd.exe /k pushd %L"
Just use the explorer to navigate to the bin or any directory. then enter cmd at the address bar und hit return. the command line with start at this location.
You can do it with python:
If you don't have activepython already, download from ActiveState's Website. Next, run PythonWin and create a new script. Write the following:
from subprocess import *
Call("c://program files//mysql//bin//mysqldump.exe")
Save the script somewhere. When you want to run it, just doubleclick. There are easier ways if you like writing batch files, but Python is more succinct than even windows for this case.
Just put c:/program files/mysql/bin/ into your path...
Then you can run mysqldump.exe directly without even opening a cmd prompt by typing it into " Start > Run "
I was using the MS PowerToy for a while but moved on to the open source Open Command Prompt Shell Extension because of the key feature:
(copied verbatim from the website)
The ability to open a command prompt in the directory that you are currently in by right-clicking on any empty screen space in the directory. This eliminates the need to navigate up a level in order to open a command prompt in the current directory.
Having to actually click on a folder to open the command prompt using the MS tool was a annoyance for me... especially since I always need to run command line tools on my current directory at the time.