Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
Is there a command line FTP client where you can upload a whole directory?
Or does anyone know how to make a bat file that uses window's ftp client to upload a directory?
Any thing would be helpful, thanks.
Try with WinSCP (see CLI docs) or NcFTP
Here's how you can do it in a batch file:
#ftp -i -s:"%~f0"&GOTO:EOF
open ftp.host.com
username
password
folder
mput "*.*"
disconnect
bye
replace the "parameters"(ftp.host.com, username, password, folder) with your own and save it as a .bat
Here's more information on ftp scripts in batch
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I installed vim on windows 10 using chocolatey. When I edit a file in powershell, everything works great! I even got copy and paste to work. However, when I edit a git commit message, vim doesn't redraw my screen properly. If I force a screen redraw, I can see my updated text properly, but that is super annoying.
I configured git to use vim with:
git config --global core.editor vim
How can I make vim behave properly?
TLDR
Giving git the direct fully-qualified path to my vim executable fixed things, and I don't know why:
git config --global core.editor "'C:\tools\vim\vim82\vim.exe' -f -i NONE"
Single quotes around the path are important because git doesn't know how to handle paths with backslashes.
Double quotes around the whole configuration are important so that git doesn't apply -f -f NONE to the git config command.
I found -f -i NONE on this answer, and I don't know what it does, but git commit didn't work without it.
How I found the full path
vim adds a c:\windows\vim.bat file, which is what powershell uses to launch vim when you type vim:
PS C:\Users\heath> Get-Command vim
CommandType Name Version Source
----------- ---- ------- ------
Application vim.bat 0.0.0.0 C:\windows\vim.bat
vim.bat is pretty simple:
#echo off
rem -- Run Vim --
rem # uninstall key: vim82 #
setlocal
set VIM_EXE_DIR=C:\tools\vim\vim82
if exist "%VIM%\vim82\vim.exe" set VIM_EXE_DIR=%VIM%\vim82
if exist "%VIMRUNTIME%\vim.exe" set VIM_EXE_DIR=%VIMRUNTIME%
if not exist "%VIM_EXE_DIR%\vim.exe" (
echo "%VIM_EXE_DIR%\vim.exe" not found
goto :eof
)
"%VIM_EXE_DIR%\vim.exe" %*
Thus, my full vim path is C:\tools\vim\vim82\vim.exe
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
I am aiming to extract host and port number from the url. Could you please update me any examples to do it using perl regex or sed/awk etc?
echo "https://xxxx:port/services"
I am looking for an oneliner to extract host and port.
perl -MURI -nle'$u = URI->new($_); printf "%s:%s\n", $u->host, $u->port'
Works even if the port is implied. (e.g. http://stackoverflow.com/)
Works for HTTP, HTTPS, FTP and some others that have the concept of a host and port.
Specifying file to process to Perl one-liner
I do this so often that I made a little sprintf-like utility for it: App::url. This isn't useful if you can't install the module and easily use the command-line program, but locally it's quite helpful to extract and rearrange things:
$ url "%h:%p" http://www.example.com/a/b/c
www.example.com:80
$ url "%h:%p" http://www.example.com/a/b/c https://www2.example.org:444
www.example.com:80
www2.example.org:444
$ url "%h -> %I" http://www.example.com/a/b/c
www.example.com -> 93.184.216.34
Often I use this with a little AppleScript I wrote to get all the URLs from all the tabs in Safari:
$ safari-tabs 2>&1 | xargs url %h
www.google.com
github.com
dnschecker.org
securitytrails.com
st.aticpan.org
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
How command prompt communicate with hardware
if i give mkdir command it will create the directory
how this command works internally
can i create own commands.
You need to notice the difference between the OS and the shell. Shell is only a user-land program. When you type a command, the command is the name of another program(or some built-in command in shell itself), shell find the corresponding program and execute it.
The operations at this level is much higher than hardware, it's just user-land program call.
For mkdir, you type which mkdir then will find the path of this program named mkdir. If you want to create your own, just compile your own program and run it from shell.
First of all MKDIR doesn't change the Directory it Makes the new directory.
& These program internally runs like a Bash Script/Batch File, which are few predefined codes in the OS.
You can create your own command by creating Batch File, For which you need Notepad, Little Programing Skill & Output Parameters you Want To Achieve.
This Link Might help Creating CMD File
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have a batch file called test.bat. I am calling the below instructions in the test.bat file:
start /min powershell.exe %sysdrive%\testScripts\testscript1.ps1
When I run this through the command prompt, my testscript is running successfully. I want to run it as administrator (as if I have created a desktop shortcut and run as administrator. It shouldn't prompt for any username or password).
I have tried adding /elevate and /NOUAC parameters in the above test.bat, but no luck. How do I fix this issue?
I know how to do it manually, but I want this to be executed from the command prompt.
(By Marnix Klooster): ...without using any additional tools, like those suggested in an answer to Super User question How to run program from command line with elevated rights.)
Try this:
runas.exe /savecred /user:administrator "%sysdrive%\testScripts\testscript1.ps1"
It saves the password the first time and never asks again. Maybe when you change the administrator password you will be prompted again.
See this TechNet article: Runas command documentation
From a command prompt:
C:\> runas /user:<localmachinename>\administrator cmd
Or, if you're connected to a domain:
C:\> runas /user:<DomainName>\<AdministratorAccountName> cmd
It looks like psexec -h is the way to do this:
-h If the target system is Windows Vista or higher, has the process
run with the account's elevated token, if available.
Which... doesn't seem to be listed in the online documentation in Sysinternals - PsExec.
But it works on my machine.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
My objective is to start and stop screen record using VLC from command line.
For starting the screen recording, I used the following code:
vlc screen:// -I rc --screen-follow-mouse --screen-fps 5
:sout=#transcode{vcodec=WMV2,vb=1800,scale=1}:std{access=file,mux=asf,dst=output.wmv}
And for stopping the record I learned from the VLC forums that I have to use ncat for windows and my stop BAT file contents were
echo quit | "C:\Users\Jk\Desktop\Downloads\nc111nt\nc.exe" localhost 8088
But still the stop doesn't work. I also tried the following, but it makes the recorded video corrupted:
taskkill /IM vlc.exe
Also tried
vlc ://quit but it wont work as it was not started in one-instance mode.
To stop, just run:
vlc vlc://quit