I'm trying to log the output of the wkhtmltopdf EXE to a file however the log file it creates is just blank lines with no actual output. I can see the output in the CMD window but the file the command is redirected to is blank.
C:\PROGRA~1\wkhtmltopdf\bin\wkhtmltopdf >> C:\test.txt
In the CMD window I see the documentation for wkhtmltopdf, like the below:
Name:
wkhtmltopdf 0.12.5 (with patched qt)
Synopsis:
wkhtmltopdf [GLOBAL OPTION]... [OBJECT]...
but the output file has 16 blank lines?
I've tried various alternative ways of running the command, using cmd /c or the START command, tried with powershell as well but have had no joy so far.
Any help with this would be much appreciated, thank you!
I was able to resolve this by changing the command as follows, thanks to Cpt.Whale comment for pointing me in the right direction!
C:\PROGRA~1\wkhtmltopdf\bin\wkhtmltopdf 1>> C:\test.txt 2>&1
Related
In cmd.exe if I run any command, I can see the output on the console, e.g, dir shows a list of all files on the console. But if I use dir | clip, it puts all the output on clipboard.
How to put output on console and clipboard at the same time?
You could use a 3rd party program called paste to display the contents of your clipboard, which is the actual command's output:
http://www.c3scripts.com/tutorials/msdos/paste.html
The problem with running your command twice as suggested in dinidu's answer is that if for whatever reason the output is different on the subsequent run you will not see the same output on your console than what is on your clipboard.
So something like this:
dir | clip & paste
Try this
c:\> dir & dir|clip
This might seem a bit too obvious but I am stuck with it anyway.
I am editing an ffmpeg code in notepad++ and I want to run the selected line of code directly in notepad++ console (nppexec plugin console).
say, I have four lines of code, and I want to run only the second line (selected line):
currently, I am coping the line and pasting it in the console and hitting enter. I know it is very noobie!
Please help to achieve this with a shortcut or something.
Once I created a small nppexex script, to run an external command on the selection, based on that you can use a nppexec script like:
sel_saveto c:\Temp\NPP_Selection.bat
cmd /c c:\Temp\NPP_Selection.bat
Please save your file with the ffmpeg command with ansi encoding (with UTF8 there was an error with some strange characters at the start of the selection).
The script stores the selection in a bat file and then runs it with cmd /c
Would someone please help me with this. I need the ruby output to be directly copied to clipboard.
I recently discovered GeoIPGen and it is awesome. I made a .bat script that runs GeoIPGen through which it generates a random IP but I need to make it to copy itself to clipboard.
Can you help me with this one?
Thanks in advance!
.BAT SCRIPT CODE EXAMPLE
C:\Ruby193\bin\ruby.exe C:\geo\geoipgen -n 1 US
pause
There is a gem called clipboard that provides the capability to store data in the system clipboard programmatically.
I found a soulution since I am using Command Prompt:
HowToGeek Tutorial - How to copy output text from the command line to the windows clipboard
How can I get a script's output to be copied to the Windows clipboard?
I have the below code that executes and stores the output to a text file, and then display the output to console.
robocopy %TOBEZIPPED% %TEMPDIR% *.* /E > Log.txt & type Log.txt
but since I'm using the robocopy command that shows progress while it is copying, I would like it to show as it was intended and then store the output (maybe history of the command) to a text file..
How can I do it? I've tried doskey /history from a google search but can't still solve my issue.
Hope someone can help me.. Thanks in advance..
EDIT: I have searched related questions but have not found the same with what I wanted.. please note that the result of output should be displayed first normally (not echoed or typed, see robocopy command) before redirecting it to the output file.. so it's like command will display first as usual, like a command history - after execution, will then be redirected to an output file..
For Shell only:
Use tee:
tee is a command in command-line interpreters (shells) using standard streams which reads standard input and writes it to both standard output and one or more files, effectively duplicating its input.
e.g.
robocopy %TOBEZIPPED% %TEMPDIR% *.* /E | tee -a Log.txt
If you want to do it in windows you need to use PowerShell http://en.wikipedia.org/wiki/Windows_PowerShell . This will provide you tee command to be executable on windows.
I have a small command line tool and after running it, I'd like to display the text output in a way that's easy for someone to copy/paste and save it or email it to someone else.
Copy/pasting from a command prompt is not done in the standard way, so I don't want people to have to copy/paste from there. Saving the file to disk is possible, but the folder where the tool is located may not have access rights so the user would have to configure the output file location (this may be too tricky for some users).
I was thinking of launching notepad with some text in it, generated from the command line tool. Is this possible? Any other suggestions?
You can use clip.
After you have clip, which can be downloaded from the link above, you use the pipe (|) command to copy the previously executed command's output to the clipboard.
The article gives you the full explanation, but here are the basics with examples:
dir /h | clip – Copy the help manual for DIR command to the clipboard
tracert www.labnol.org | clip – Trace the path from your computer to another website – the output is automatically copied to the clipboard and not displayed on the screen.
netstat | clip - Check if your computer is connecting to websites without your knowledge.
I think your command sould receive the destination e-mail as a parameter and then after executing, your command you can have simple script/.BAT file which e-mails your text output to the user using the standard Telnet SMTP commands, like explained for example in the following page:
"http://www.yuki-onna.co.uk/email/smtp.html".
You could add an option to your program that tells it to copy its own output to the clipboard using the clipboard API. Then the user could just paste it.
I like the clip suggestion, though.