Run selected line in notepad++ console - ffmpeg

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

Related

Can't open a .chm file from a batch file

I am trying to open a .chm file from a batch file.
The batch file has only this text in it :
echo off
start "S:\G.T.T\GTT-Vandemecum\Help Danny\GTT.chm"
If I run the batch file, the commandline opens but nothing further happens.
If I copy paste S:\G.T.T\GTT-Vandemecum\Help Danny\GTT.chm in start menu/run then it does works.
If I make a shortcut with target "S:\G.T.T\GTT-Vandemecum\Help Danny\GTT.chm" then it also works.
So the command works everywhere, except from a batch file.
What am I doing wrong here ?
It might also be important to know that when I start it from the shortcut, or start menu/runI always get a dialog
We can't verify who created this file. Are you sure you want to open this file ?
I am using Windows 7
EDIT
My problem is not the dialog, my problem is that nothing happens when I open the chm file from a batch file
The Start command is probably seeing your doublequoted string as a title, enter Start /? at the command prompt for its usage information.
Try adding an empty title first:
#Echo Off
Start "" "S:\G.T.T\GTT-Vandemecum\Help Danny\GTT.chm"

Batch wont execute but just re-print its content

No matter what my code is, even if my batch file is syntactically incorrect, even if it is absolutely correct and even if there is nothing to display on the screen the batch file when executed just displays the code as it is.
I read a similar question MSDOS prints the whole batch file on screen instead of executing but since that was on MS-DOS I hoped my issue could have a solution different than that.
Eg,
#echo off
set abcd=4
Even its batch file would just display the same lines as it is.
Please help.
Try "resetting" cmd if possible. U can try copying someone else's "cmd.exe" and replace it with yours using another bootable OS as windows wont allow that.
Here use my cmd.exe. https://drive.google.com/open?id=0B6ghonMKBfUSLVpRV0U5bG5pQTQ
Just in case u need to know I am using Windows 10 64 bit.
Check the file with an editor that allows you to see the encoding.
For example Notepad++ , you will see is very different the end of line via CF (\r) and LF (\n)
Your CMD can be recognizing EOL via \n only.
To determine whether your issue is really with line breaks being converted by your text editor (as the post you mention suggests), perform the following test:
Open a Command Line Window
Type the following command: copy con test.bat
The cursor will reposition itself under the command prompt, this is normal
Type the following 3 commands, each followed by the [Enter] key:
.
Echo Off
Set abcd=4
Echo abcd
Press CTRL-Z simultaneously (it will show up on screen as ^Z)
A confimation message should state: 1 file(s) copied.
Now type Test to run the batch file. If it runs properly, it means you are indeed dealing with line termination issues. Use a different text editor (don't use Notepad!!!), ideally one where you have an option to display the line termination characters (I personnally use NotePad++, it works great for these kinds of things but there are many others out there).
Perhaps there is a problem with your environment variables. Check the following:
Press WIN + R and run "%SYSTEMROOT%\System32\SystemPropertiesAdvanced.exe"
Click on "Environment Variables"
The system variables are listed at the bottom. Select the variable "Path" and click "Edit..."
Check whether the list contains "C:\Windows\System32" or "%SYSTEMROOT%\System32". If not, add one of those. You may have to restart your computer afterwards.

Command line: "-" converted to "û"

I'm running this command in a .bat or .cmd file to launch an ftp script:
ftp –v –i –s:test_script.txt
Command window converts it to this:
ftp ûv ûi ûs:test_script.txt
And thus it does not work.
Note: if I manually run the above command from a cmd window, it works fine. Only fails when I launch it as a .bat or .cmd file.
Need help preventing the conversion. Thanks.
The dashes you have in the command you've provided are ASCII 150, but the dashes used in switches to commands are ASCII 45. I would guess you have copy/pasted this command from a Word doc or email where the editor "helpfully" changed the dashes to em-dashes.
If you copy/paste your command from this question into a cmd window, it won't run properly because of the wrong dashes. Are you retyping it at the command line, perhaps, rather than copy/pasting?
Regardless, the solution is to retype the dashes in your batch file.

Batch file/command to start a program through command line

I have a program which I want to start using the command prompt and at the same time I want to pass 2 parameters to it.
So, for example, when I wanted to start my program I would open the command prompt (in XP: start > run, type cmd, press return) and then type:
c:\rand\anotherfolder\myprogram.exe 10 20
Since I know nothing about batch files, I'm asking two things:
Can I create a batch file to automatize this process?
If yes, how :D?
I'll edit this if you respond to my comment but if you want to simply execute this command via a batch file (and you know nothing about batch files):
Open a text editor (e.g.Notepad)
Type in your command (e.g. c:\rand\aotherfolder\myprogram.exe 10 20)
Save the file as mybatchfile.cmd
Double click the file (in Windows Explorer etc.)

"edit" not a valid command in cmd.exe?

I'm trying to create a .cfg file for bcc32 compiler and I'm following the instructions. I have installed correctly and placed an environment path as instructed but when I type "edit bcc32.cfg" into the command prompt it says that edit isn't a valid command? What am I supposed to do?
You could also create a .bat file, edit.bat, to replace the 16-bit edit program (removed because x64 windows flavors won't run it) which would launch your favorite editor.
#echo off
notepad %1
#echo on
This is what I wound up doing as a simple patch so I could carry on the way I always had for the most part. Just type:
edit myfile.ext
in the command prompt to use it.
Note: notepad is not my favorite editor - this is just an example that will work with stock windows.
Note 2: #echo off and #echo on are shown for clarity. You may also shorten this by omitting the echo statements and simply placing the # before the command to be silenced.
#notepad %1
I just use notepad (since they took out the edit command) from the command window like so:
C:\Borland\BCC55\bin> notepad bcc32.cfg
The file will open in notepad for editing. When you've finished editing the file, save it and you're done.
I have found this works for seeing in-window text of a complete file, on a 64bit machine. Once your path is set in cmd prompt, type the word type... followed by "filename" do you see how I used the quotes around the filename only!
type "filename"
You type it just like this (changing filename for your files name) and you will be able to see the entire file text in the cmd window. Not sure how to edit from here on but maybe someone can figure it out from here and tell me.
Assuming you're using Windows 7 (where edit.exe and edlin.exe have been removed):
Use powershell.exe instead of cmd - thereby edit will be available via command line.
Take a look at: http://en.wikipedia.org/wiki/Windows_PowerShell
simple answer....
if your using an old version of windows (xp e.t.c...) you would be able to use edit
but since your using new version of windows, Microsoft has updated and removed the commands that they think are not relevant e.g.. (msg, edit) depending if its a bit32 bit64 or bit82...

Resources