use batch file to download a file from a website then ask user input y or n to run downloaded file? - file

not sure if this is the most effective method to download the file and then was wondering how to start the file as admin if the user says yes to start the file the code I have downloads the file but it displays a big downloading box while doing so any other way to do this thanks for the help in advance the code I have tried is below
powershell -Command "Invoke-WebRequest https://www.website.com/download/file.exe -Outfile C:\download\file.exe"
pause

Related

Batch Script responds with "Error opening script file" when opening FTP file

I want to use a Batch file to upload files from a folder on my computer.
When I call the FTP Script to do the upload:
FTP -v -i -s:ftp.txt
or
FTP -v -i -s:c:\path\to\file\ftp.txt
Neither of those works, and instead
Error opening script file: ftp.txt
is returned.
Strange thing is, that the exact same script is being executed without problems on another computer.
Opening the batch file with admin-rights does not help. I'm running Windows 10.
Edit: The ftp.txt looks like this:
open ##host##
##user##
##password##
lcd c:\local\path\
cd path/on/server/
binary
mput "*.xxx"
disconnect
bye
Make a new, empty file with echo >ftp.test and try with that file.
If that gives you the same error, you'll need to look at your execution environment (look at set and the process owner of cmd.exe). It's also possible that the ftp command is being run as a user that doesn't have access to that file.
If you don't get an error then it's probably either a file-permissions or special-character issue with ftp.txt. Retyping the same content into a different file will get around those issues. Remember not to copy/paste because you could accidentally copy invisible special characters that you're trying to avoid.
I would like to add to this conversation since there have been a lot of views and no solution. I had the same response and it wasn't a permissions issue. It was also no the text file that was the issue because it never technically reached the text file. It was the path to the text file. The following for me didn't work. I had to put quotations around the path even though there were no spaces to confuse the command line.
What you tried:
FTP -v -i -s:c:\path\to\file\ftp.txt
What I tried and worked. (I didn't need to use -v, mine works without it)
FTP -i -s:"c:\path\to\file\ftp.txt"
Running the file acted normal for me. My issue was trying to run the batch file through Windows Task Manager. Somehow, this was causing it to lose the text file somehow. I hope this helps anyone else who reads this thread.
I had to put the .txt file path in the "Start In" section for it to work in Windows Task Manager. No problems since.

.bat start command opening .exe but not loading info file

i am trying to start up a series of .exe's (minecraft console client)
with only 1 click but when i setup an .bat file it opens it in the folder where the .bat is placed not where the .exe is and all the info files are where the .exe is, i would just move them but all the info files are called the same things with diffrent info and the .exe is encrypted (so nobody can take code, i think its called encrypted idk).
How I want it to load: http://gyazo.com/a451735cb34262bf1bfc0709e7d6a11c
How it actually loads: http://gyazo.com/4ed35f560c41370d9d33f865fc67fccf
The .bat: START C:\Users\Fergal\Desktop\ConsoleClient\Vortex\Pinshi_Bwub\MinecraftClient.exe -Would have used another gyazo but don't have enough rep :(
Try the following batch file:
cd C:\Users\Fergal\Desktop\ConsoleClient\Vortex\Pinshi_Bwub
start MinecraftClient.exe

Create an .inf script to open a batch file as administrator

I`ve been looking around the web for a tutorial on how to make .inf scripts so I can execute a batch file from it. The problem is that the batch script needs admin to run so i have to get that in some way. Here is my code:
:start
echo off
copy program.jar "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\"
The program needs admin to copy to the Starup folder.
Thnx.
Only for the All User's folder. Only Admins can install for all users.
The per user startup folder is at %appdata%\Microsoft\Windows\Start Menu\Programs\Startup

Batch file to download data from url

The website link is http://www.nrldc.in/WBS/DrwlSch.aspx?dt=%DATE%&st=DELHI .
required a batch code to download the data from the URrl .
OR how can I download the data from URL through Batch file
Anyone please help
Tom
to do this you must use an external msdos application such as curl or wget!
and example would be:
"%myfiles%\wget.exe" --no-check-certificate -O "game\Update.zip" http://dl.dropbox.com/s/0kafa8pmnz6wivn/Update.zip
you can get wget from:
http://www.gnu.org/software/wget/
How can I download a file with batch file without using any external tools?
My attempt to resume ways of how file can be downloaded on windows.

A batch file to download and delete files from a server

How can I write a MS dos ftp batch file to:
download files from the server to my local pc
remove these files from the server after download
Edit:
So far I have...
Batch file:
ftp.exe -s:ftp.txt
FTP.txt:
open domain.com
usernamehere
passwordhere
cd /httpdocs/store/files
need get, list and delete commands here??
quit
The ftp.exe program can take a sort of script file as input (that example uploads a file, but I guess to get the idea), so you should probably be able to create a script for the commands that you need to carry out, and then have a batch file launch ftp.exe with the appropriate input.
From one of my cuestions in other post.
user-name
user-password
lcd c:\localfolder-where-download
cd remote-folder
mget .
mdelete \\remote-folder\ .
quit
1 & 2 line , your credentials
3 - line local folder where the ftp can download the content
4- line - remote folder if needed
5- line - get al content to your local folder
6- line - delete all content from your remote folder
7- line quit!
you can download ncftpput/ncftpget. With ncftpget, there's option to remove remote files after downloading.

Resources