Gracias por la sugerencia pero a veces utilizo los comodines \..\ en curl y otras aplicaciones no los gestionan bien.
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes Menú<?php
function retrieve_remote_file_size($url){
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, TRUE);
curl_setopt($ch, CURLOPT_NOBODY, TRUE);
$data = curl_exec($ch);
$size = curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD);
curl_close($ch);
return $size;
}
echo retrieve_remote_file_size("https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png");
?>
@echo off
for /f "tokens=2 delims==" %%G in ('wmic os get localdatetime /value') do set datetime=%%G
set yyyy=%datetime:~0,4%
set mm=%datetime:~4,2%
set dd=%datetime:~6,2%
set dd=%datetime:~6,2%
echo %dd%-%mm%-%yyyy%
set /a dd=%dd%-1
echo %dd%-%mm%-%yyyy%
if %dd% LSS 10 set dd=0%dd%
porque la suma o resta se puede repetir y añadiría un cero cada vez. Las veces que se repita la resta es variable.Cita de: EdePC en 27 Marzo 2021, 07:20 AM
...Para usarlo en un .bat hay que poner dobles %%:(for /f %%a in ('dir /b *.jpg') do @set/p="%%a "<nul)>listado.txt
import os
import subprocess
from remotezip import RemoteZip
with RemoteZip(url.zip) as zip:
zip.extract('archivo.txt')
import os
import subprocess
subprocess.run('curl.exe --path-as-is "http://servidor/../directorio/archivo.zip" -o archivo.zip')
@Echo OFF
PUSHD "%TEMP%\ttdje"
PowerShell.exe "& \"%CD%\script.ps1\" "
POPD
Set-Location ([System.IO.Path]::GetTempPath() + "ttdje")
Write-Host (Get-Location)
$srcFilePath = ".\temp.txt"
$dstFilePath = ".\temp2.txt"
[System.Reflection.Assembly]::LoadWithPartialName("System.Text.dll")
$textEncoding = [System.Text.Encoding]::Default
$filecontent = [System.IO.File]::ReadAllText($srcFilePath, $textEncoding)
$replacedText = ($filecontent).Replace(".zip", "")
[System.IO.File]::WriteAllText($dstFilePath, $replacedText, $textEncoding)
Write-Host $replacedText
Exit(0)
Set-Location ([System.IO.Path]::GetTempPath() + "ttdje")
Write-Host (Get-Location)
$srcFilePath = ".\temp.txt"
$dstFilePath = ".\temp2.txt"
$textEncoding = [System.Text.Encoding]::Default
$filecontent = [System.IO.File]::ReadAllText($srcFilePath, $textEncoding)
$replacedText = ($filecontent).Replace(".zip", "")
[System.IO.File]::WriteAllText($dstFilePath, $replacedText, $textEncoding)
Write-Host $replacedText
Exit(0)
@Echo OFF
PUSHD "%TEMP%\ttdje"
PowerShell.exe "& \"%CD%\script.ps1\" "
POPD
Set-Location ([System.IO.Path]::GetTempPath() + "ttdje")
Write-Host (Get-Location)
$srcFilePath = ".\temp.txt"
$dstFilePath = ".\temp2.txt"
[System.Reflection.Assembly]::LoadWithPartialName("System.Text.dll")
$textEncoding = [System.Text.Encoding]::Default
$filecontent = [System.IO.File]::ReadAllText($srcFilePath, $textEncoding)
$replacedText = ($filecontent).Replace(".zip", "")
[System.IO.File]::WriteAllText($dstFilePath, $replacedText, $textEncoding)
Write-Host $replacedText
Exit(0)
[System.Reflection.Assembly]::LoadWithPartialName("System.Text.dll")
$srcFilePath = ".\temp.txt"
$dstFilePath = ".\temp2.txt"
$textEncoding = [System.Text.Encoding]::Default
$filecontent = [System.IO.File]::ReadAllText($srcFilePath, $textEncoding)
$replacedText = ($filecontent).Replace(".zip", "")
[System.IO.File]::WriteAllText($dstFilePath, $replacedText, $textEncoding)
Write-Host $replacedText
Exit(0)
@Echo OFF
PowerShell.exe "C:\Ruta absoluta del script.ps1"
@Echo OFF
PowerShell.exe -ExecutionPolicy Bypass -Command "& Ruta absoluta del script" >nul
@Echo OFF
PowerShell.exe -ExecutionPolicy Bypass -Command "& %temp%\ttdje\script.ps1" >nul