from R console windows equivalent of wget - windows

Hi I was wondering what the windows equivalent of wget is
I currently have a function in R that has the command
system("wget www.random.url.com/file")
to download a file from the internet from a mac/unix machine that is running R...what would the equivalent be for R in windows?

Look at download.file to download files to your computer. This works on all operating systems, including Linux, Mac, and Windows.

powershell -command "iwr -outf abc.zip http://example.com/xyz.zip"

Related

Universal copy command for Windows and Linux

I was just curious that is there any universal command to copy files. Which should work for both Windows and Linux system.
I know Windows uses copy command and Linux uses cp command. But is there any universal command to do so.
If powershell is installed in your Windows OS,
then you can use the built-in command cp as well, just like Linux does.
UNIX/Linux, Mac, and Windows can all run PowerShell Core 6. https://github.com/powershell/powershell
The command is Copy-Item, but there are three (3) aliases. Using an alias at a command prompt is fine, but they should not be put into script files.
>Get-Alias -Definition Copy-Item
CommandType Name
----------- ----
Alias copy -> Copy-Item
Alias cp -> Copy-Item
Alias cpi -> Copy-Item
Since there is no "universal" command, something will need to be installed on every machine except those that already have the command you choose to make "universal." At a minimum, it would be a .bat/.cmd script on Windows or a shell script on UNIX/Linux/Mac. Choosing to implement it in Python or any other language would require that language to be installed.
There is no universal command to do this, but you have several workarounds:
use cygwin or msys on Windows to have the Linux equivalent commands on windows
use Windows Powershell (partially compatible, but works for cp)
provided that your environments all have python installed, write a python script that does what you want .

Convert simple line of batch file to bash

To run the program zandronum.exe with the file brutalv21.pk3, the instructions for windows give this piece of batch file code:
#echo off
start zandronum.exe -file brutalv21.pk3
But I downloaded zandronum for Linux. What is the equivalent in Bash?
The syntax is simple:
./filename -Arguments
So, you have to write:
./zandronum -file brutalv21.pk3
windows programs won't just run under linux you'll need wine to run them. as far as I've heard ubuntu made running windows programs with wine pretty seamless

Alternative command for Vi/Cat in Windows 7

In Unix/Linux we are having vi & cat command to view or edit a file. There are any alternative command to view/edit a file in windows command prompt.
Cygwin is a large collection of GNU and Open Source tools which provide functionality similar to a Linux distribution on Windows.
It includes both cat and vi.
It is possible to select which parts of Cygwin to install. See Installing and Updating Cygwin Packages for more instructions.
There is a edit on windows but it doesn't work on 64Bit machine. So alternate solution is given below.
Just download vim for windows from Here (direct download link), on the installation it will ask if you want to create shortcuts for calling it from the command line. Then you can just vim
For Windows, To view the filename use, Type filename

Download file to null (Windows CLI)

I would like to download a file to null in windows cli just for testing purposes.
In linux i used
wget http://download.thinkbroadband.com/1GB.zip -O /dev/null
This kept my connection busy for a while.
Is there any way to do this in command prompt or power shell in windows 7?
Also other solutions to generate traffic from internet,ut withous saving it to disk, will be accepted.
Using Windows' (roughly) equivalent NUL device should mimic the Linux behaviour sufficiently:
wget http://download.thinkbroadband.com/1GB.zip -O NUL
Update: Recent builds of wget for Windows are available here.
You can use that exact same command on any Windows with Cygwin. Make sure you select Wget in the package list when installing Cygwin

What file explorer can I use in Cygwin with UNIX like paths?

I'm fed up with using Windows Explorer as my file browser as I use
Cygwin bash as my primary command line environment.
Windows Explorer shows the full path in the address bar.
Usually, I copy that, pasting it to the cygwin command prompt as in
cygpath ""
I then copy paste the output of cygpath so I can
cd to it. I've also set up cpath "Bash Shell Here"
but this only works on right clicking directories.
I've used WinSCP via SSH.
ie. Start an SSH daemon in cygwin and connect to it via WinSCP.
What file explorer can I use in Cygwin with UNIX like paths?
Is there a cygwin X Windows file explorer?
Have you tried Midnight Commander (mc)? It's in the Cygwin package repository.
If you surround the path from Windows Explorer with single or double quotes, there is no need to use the cygpath command.
In regard to your quest for a compatible file manager, I've heard that KDE's Konqueror runs on Windows.

Resources