制作.js文件从互联网上下载一个文件
Making a .js file download a file from the internet?
我有一个正在编写的批处理程序。我已经制作了一个名为"filedownload.js"的文件。我需要"filedownload.js"才能下载文件
http://www.batchfilegamescontent.elementfx.com/examplefile.txt
到特定文件夹。例如;
C:'Users'%Username%'desktop'RamTach'data'
然后我需要批处理文件来运行"filedownload.js"文件。我可以使用吗
md ".settings"
call filedownload.js
在"filedownload.js"上
setTimeout(function () { window.location = 'http://www.batchfilegamescontent.elementfx.com/examplefile.txt'; }, 0)
工作?
从互联网下载文件的最佳方式是使用我的名为MGet的应用程序下载文件,它没有硬语法。网址:http://bit.ly/1i1FpGE语法:
MGET http://www.batchfilegamescontent.elementfx.com/examplefile.txt examplefile.txt
如果您想使用javascript,可以使用node.js:进行尝试
var http = require('http');
var fs = require('fs');
var file = fs.createWriteStream(your_path);
var request = http.get(your_url, function(response) {
response.pipe(file);
});
然后运行node <scriptname>.js
@if (@X)==(@Y) @end /****** silent line that start jscript comment ******
@echo off
::::::::::::::::::::::::::::::::::::
::: compile the script ::::
::::::::::::::::::::::::::::::::::::
setlocal
if exist simpledownloader.exe goto :skip_compilation
set "frm=%SystemRoot%'Microsoft.NET'Framework'"
:: searching the latest installed .net framework
for /f "tokens=* delims=" %%v in ('dir /b /s /a:d /o:-n "%SystemRoot%'Microsoft.NET'Framework'v*"') do (
if exist "%%v'jsc.exe" (
rem :: the javascript.net compiler
set "jsc=%%~dpsnfxv'jsc.exe"
goto :break_loop
)
)
echo jsc.exe not found && exit /b 0
:break_loop
call %jsc% /nologo /out:"simpledownloader.exe" "%~dpsfnx0"
::::::::::::::::::::::::::::::::::::
::: end of compilation ::::
::::::::::::::::::::::::::::::::::::
:skip_compilation
:: download the file
::::just change the link and the file::::
simpledownloader.exe "http://pastebin.com/raw.php?i=id7CWRHF" "target.bat"
exit /b 0
****** end of jscript comment ******/
import System;
var arguments:String[] = Environment.GetCommandLineArgs();
var webClient:System.Net.WebClient = new System.Net.WebClient();
print("Downloading " + arguments[1] + " to " + arguments[2]);
try {
webClient.DownloadFile(arguments[1], arguments[2]);
} catch (e) {
Console.BackgroundColor = ConsoleColor.Green;
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("'n'nProblem with downloading " + arguments[1] + " to " + arguments[2] + "Check if the internet address is valid");
Console.ResetColor();
Environment.Exit(5);
}
检查一下。Will无需任何外部工具。将其保存为.bat
。这应该会下载您的文件。只需更改链接和目标
相关文章:
- 当包含另一个asp文件时,是否也包含所有引用的样式和脚本页面
- 将jsp文件下拉列表中的选定项分配给一个java变量(比如String selection)
- 如何在android中使用phonegap将文件从一个文件夹移动/复制到另一个文件夹
- 如何在elfinder插件(一个文件管理器插件)上获得上传前事件
- 我应该如何从xml文件构建一个javascript页面
- Sails.js:同时发布文本输入和一个文件
- Webpack/Rect:遵循egghead.io教程,但出现错误:您可能需要一个合适的加载程序来处理此文件类型
- 正在传递JSONP标头's数据参数到另一个文件中的AJAX请求
- 要求定义另一个文件中的对象
- 是否可以使用JavaScript/AAJAX在客户端创建一个文件
- SuiteScript2.0-包括一个自定义文件
- 有没有办法在tinymceiframe中加载一个外部javascript文件
- 如何将变量传递到另一个js文件
- 如何将所有JS文件连接到一个文件夹中
- 从Chrome扩展名中的popup.html文件在background.js文件中运行一个函数
- 如何用javascript发送多个文件没有jQuery我想要每个文件一个进度条
- 我正在尝试一个接一个地播放一个 mp3 文件(一个作为介绍),但它不起作用.我该怎么做
- Jquery结构-每个文件一个函数
- 如何将文件一个接一个地上传到谷歌驱动器使用谷歌应用程序脚本
- 将多个链接从txt文件一个接一个地插入到一个iframe中