PDA

View Full Version : File .bat creazione file report e salvataggio password


HdPazzo
04-04-2018, 18:25
Ciao, sono nuovo nel campo sto cercando di creare un file .bat che si avvia una volta estratto dal file .exe creato con winrar, dopo di che crea il file report dell'HW e lo comprime proteggendolo con una password in conclusione elimina la cartella dei file estratti, il file .exe creato con winrar (vorrei proteggerlo con password solo se si prova ad aprirlo e non ad avviarlo) e rimane solo il report protetto contro le modifiche involontarie.
C'è qualcosa che non va nel file bat, vorrei non far comparire le operazioni di compressione di WinRar e la lista dei file cancellatti con il comando Del, potete aiutarmi? Questo e per il test:


TITLE Prova

@echo off

echo
echo
echo Inizio Report Hardware
echo
echo Attendere..
echo

cd %USERPROFILE%\AppData\Local\Temp\ReportCN\ReportHW

AIDA64.exe /R %USERPROFILE%\AppData\Local\Temp\ReportCN\InfoRam /HW /MHTML /LANGIT /SILENT


echo
echo
echo Salvataggio Report Hardware
echo

cd %USERPROFILE%\AppData\Local\Temp\ReportCN\WinRAR

Rar.exe a -t -u -df -hp[Prova] -k c:\Report.rar %USERPROFILE%\AppData\Local\Temp\ReportCN\InfoRam.htm

CLS
echo
echo
echo Inizio Report Hardware
echo
echo Attendere..
echo
echo
echo
echo Salvataggio Report Hardware
echo

echo
echo
echo Finalizzazione Report Hardware
echo

del %sfxname%

cd %USERPROFILE%

del /F /S /Q %USERPROFILE%\AppData\Local\Temp\ReportCN\ReportHW

CLS

del /F /S /Q %USERPROFILE%\AppData\Local\Temp\ReportCN\WinRAR

CLS

echo
echo
echo Inizio Report Hardware
echo
echo Attendere..
echo
echo
echo
echo Salvataggio Report Hardware
echo
echo
echo
echo Finalizzazione Report Hardware
echo

echo
echo
echo Report Completato, prelevare file InfoRam dal percorso C:\.
echo

Pause
del /F /S /Q %USERPROFILE%\AppData\Local\Temp\ReportCN

x_Master_x
10-04-2018, 16:56
"INSERIRE_COMANDO_QUI" >NUL 2>&1
Redirect dell'output, puoi usare anche un file di testo per controllare eventuali errori.

HdPazzo
11-04-2018, 09:21
Grazie per avermi risposto, non n'è so molto. Potresti spiegarmi a che serve il comando >nul ed il comando 2>&1?
Nel file TXT li devo inserire sulla stessa riga del comando o va bene anche sotto?

x_Master_x
11-04-2018, 14:32
A cosa servono i comandi c'è Google. Riguardo al TXT

"INSERIRE_COMANDO_QUI" > Output.txt 2>&1
"INSERIRE_COMANDO_QUI" >> Output.txt 2>&1


> Sovrascrive
>> Appende al file

HdPazzo
11-04-2018, 14:46
Si, so che c'è google.
Ho chiesto a te perché non lo trovo, se cerco comando batch 2>&1 fuoriescono dei dati di pulsanti elettrici o altre cose che non capisco.
>Nul per non visualizzare le operazioni dei comandi avviati.
>2>&1 non so, non l'ho trovato.

x_Master_x
11-04-2018, 15:44
command > file
Write standard output of command to file

command 1> file
Write standard output of command to file (same as previous)

command 2> file
Write standard error of command to file (OS/2 and NT)

command > file 2>&1
Write both standard output and standard error of command to file (OS/2 and NT)

command >> file
Append standard output of command to file

command 1>> file
Append standard output of command to file (same as previous)

command 2>> file
Append standard error of command to file (OS/2 and NT)

command >> file 2>&1
Append both standard output and standard error of command to file (OS/2 and NT)

commandA | commandB
Redirect standard output of commandA to standard input of commandB

commandA 2>&1 | commandB
Redirect standard output and standard error of commandA to standard input of commandB (OS/2 and NT)

command < file
command gets standard input from file

command 2>&1
command's standard error is redirected to standard output (OS/2 and NT)

command 1>&2
command's standard output is redirected to standard error (OS/2 and NT)


Vedi quote

HdPazzo
11-04-2018, 16:20
Grazie, cerco di tradurre.