wget on Windows command line - windows

Basically I'm trying to download images from a website using the following command (SwiftIRC is an easy example to use):
wget.exe -r -l1 -A.png --no-parent www.swiftirc.net/index.php
This command works fine, however one of the ways I am trying to do it isn't working.
When I fire up an elevated command prompt, default to windows\system32.
If I use to following two commands everything works fine:
cd c:\users\tom\downloads\\
wget.exe -r -l1 etc. etc.**
The images are saved in the folder www.swiftirc.net in my downloads folder.
However if I try to do this in one line like this:
c:\users\tom\downloads\wget.exe -r -l1 etc. etc.
The response from wget on the cmd is exactly the same, but the images are not saved on my hard disk.
Does anyone know what I'm doing wrong?

Try adding c:\users\tom\downloads\ to PATH or put wget.exe into your windows/system32 folder.

I beleive it's because windows doesn't allow users to write files on the disk root, when you run "c:\users\tom\downloads\wget.exe" you have C:\ as a working directory so the files should be saved there but it's not allowed by the common strategies

Related

Batch script permissions issues

I have a batch script written to auto start and capture traffic on a server for me but for some reason when I run it wireshark tells me it doesn't have permission to the folder where the script is trying to save the file. I have tried multiple different folders on and off the server I have tried giving everyone including SYSTEM full access to the folder. I have tried remaking the folder. I have tried running under and not under admin credentials I have tried letting the system task run it. Always get a permissions issue.
The weirdest part is if I run wireshark manually and save the data manually it has no permissions issues. Just if I run the script is the problem. Although they're both run under the same admin account.
Here is the script in case you need to see the flags I used.
#echo off
cd C:\Program Files\Wireshark
Wireshark.exe -i 4 -k -a duration:10 -w C:\Temp
pause
I did try to use a powershell script I had found online but it was pretty old and I couldn't get it to actually run. So any recommendations are welcome that include powershell or batch
C:\Temp isn't a file; it's a folder. Try specifying an actual filename, like this:
#echo off
cd C:\Program Files\Wireshark
Wireshark.exe -i 4 -k -a duration:10 -w C:\Temp\foo.pcapng
pause

use the zip command specifying different path from current directory

We have a set of unix tools that were ported to windows and I want to use the zip command to package a set of files.
I'm trying to do this:
Open cmd from desktop and take the files in r:\pam\client\ssb\portfoliorepportcards\202003\*.docx and create a zip file in r:\pam\client\ssb\PortfolioReportCards\202003.zip with the files in it.
My command is:
C:\Users\JPalomino\Desktop>zip.exe -b "r:\pam\client\ssb\PortfolioReportCards" 202003.zip . -i r:\pam\client\ssb\portfoliorepportcards\202003\*.docx
zip error: Nothing to do! (202003.zip)
and I get nothing
However when I cd to r:\pam\client\ssb\portfoliorepportcards and do
R:\Pam\Client\SSB\PortfolioReportCards>zip -r 202003.zip . -i \202003\*.docx
it works like a charm. Also I wouldn't want the folder structure in it.
Could you please tell me what I'm doing wrong in the command? It seems such an easy thing to ask from zip.
Thanks
Maybe this will help, you don't need zip.exe (if you have powershell 5 or higher)...
powershell -command "Compress-Archive -Path 'r:\pam\client\ssb\PortfolioReportCards\*' 'r:\pam\client\ssb\PortfolioReportCards\202003.zip'"
I saw you're having trouble zipping to another drive letter, this should help with that too. I'm not really familiar with zip.exe to know why that's giving your grief.
Anything else you "port" to cmd is probably better off as a powershell. --- also if "zip.exe" isn't on your desktop that could possibly be your problem right there. If it works when you CD that tells me it's probably located where you're CD'ing to. Perhaps add zip.exe as an environment variable so that it can be accessed globally instead of only from the working directory.
And my take one your command (If zip is actually on your desktop or set as environment variable... : zip.exe -b "r:\pam\client\ssb\PortfolioReportCards" 202003.zip . -i r:\pam\client\ssb\portfoliorepportcards\202003\*.docx
I would re-write that and try this instead (because traditionally the filepath is all in quotes for any other windows command I know of)...
zip.exe -b "r:\pam\client\ssb\PortfolioReportCards\202003.zip" . -i r:\pam\client\ssb\portfoliorepportcards\202003\*.docx

How to open all mp3 files using windows command line?

If I have the following directory:
C:\Users\mkt\Desktop\Music\Tool\Lateralus
and want to open all files contained in the folder using cmd prompt. how could I do that?
I know that the following line will open one of them:
cd C:\Users\mkt\Desktop\Music\Tool\Lateralus\"01 - The Grudge.mp3"
But what about multiple files?
I am a noob at DOS and I really shouldn't be, but without practice you will never get better.
I am wondering, why it is opening your mp3 file with the cd command.
The cd command is used to switch directories, so this is something new for me.
I am a MAC OS user, so I could not test it, but if your given example worked, I think this should work too:
cd C:\Users\mkt\Desktop\Music\Tool\Lateralus\*.mp3
With the "*.mp3" you say, every mp3 file.
I hope this helps.

Wget Folder in Bash

I'm trying to use wget in bash to get a folder from my ftp host, but when I download the files it makes new folders for the folder that I'm downloading. For example, when I use this script to download my folder:
wget -r "ftp://$USER:$PASS#example.com/subdomains/cydia/httpdocs/theme/themes/$theme_root"
It creates a folder called "example.com" then within that one it makes "subdomains" and so on. I just want it to download the $theme_root folder that I'm downloading into the folder that I used cd to get into (/theme_builder/themes). Sorry if I'm not explaining this well but thanks in advance!
wget -nH --cut-dirs=4 -r url
I hope, than counted right... if not, change the 4 to another number.

Wget Not Downloading Every Folder

Hey, I have bash script running a wget command to get a directory:
wget -r -nH --cut-dirs=5 "ftp://$USER:$PASS#stumpyinc.com/subdomains/cydia/httpdocs/theme/themes/$theme_root"
And what it's supposed to do is download a folder structure that looks like this:
$theme_root/Library/Themes/$theme_name.theme/Icons
For some reason, it wont download any folder that's inside of the $theme_name.theme folder. There's also a UIImages folder in there that's not showing up, although files that are in that folder are being downloaded. Does anyone notice anything that I might have done wrong? Thanks in advance!
EDIT
if you add --level=inf it works perfectly!
Wget's default directory retrieval depth is 5 directories as per the wget manual. If the files you are trying to get are deeper than that from your starting position, it will not go down there. You can try giving a larger --level option or as your edit --level=inf.

Resources