- MasterDeeJay: Noname 1TB-os SATA SSD teszt
- Sub-ZeRo: Euro Truck Simulator 2 & American Truck Simulator 1 (esetleg 2 majd, ha lesz) :)
- ubyegon2: Airfryer XL XXL forrólevegős sütő gyakorlati tanácsok, ötletek, receptek
- Luck Dragon: Asszociációs játék. :)
- sziku69: Fűzzük össze a szavakat :)
- Gurulunk, WAZE?!
- droidic: YouTube videók és playlistek letöltése GUI-alkalmazással
- sziku69: Szólánc.
- Gátoljuk meg játékaink halálát!
- f(x)=exp(x): A laposföld elmebaj: Vissza a jövőbe!
Új hozzászólás Aktív témák
-
sztanozs
veterán
Session problema lehet. Mostanaban a MS kavart valamit a session-okkel, mert en is tapasztalom, hogy az SMB kapcsolatok egy ido utan bontanak, es kell jo par masodperc (akar fel perc is), mig ujraepiti oket az OS.
Erdemes kiprobalni, hogy mount elott megprobalod bontani a kapcsolatot:NET USE /delete \\UNC\path
-
sztanozs
veterán
Igen eleg egyszer kiadni a
SETLOCAL EnableDelayedExpansion
parancsot, ha menet kozben ki akarod valamiert kapcsolni akkor kell csak aSETLOCAL DisableDelayedExpansion
parancs. Viszont a valtozok hasznalatanal figyelni kell, hogy nem mindig %valtozo_nev%, hanem !valtozo_nev! formatumot is kell(het?) hasznalni. -
sztanozs
veterán
Nem vagyok benne biztos, de szerintem EnableDelayedExpansion-t kell hasznalni.
https://ss64.com/nt/delayedexpansion.html -
sztanozs
veterán
Ha nem baj, nem forditom le magyarra (megfelelo sort kiemeltem):
Parameter Extensions
When an argument is used to supply a filename then the following extended syntax can be applied:
We are using the variable %1 (but this works for any argument, including FOR parameters).
%~f1 Expand %1 to a Fully qualified path name - C:\utils\MyFile.txt
%~d1 Expand %1 to a Drive letter only - C:
%~p1 Expand %1 to a Path only e.g. \utils\ this includes a trailing \ which will be interpreted as an escape character by some commands.
%~n1 Expand %1 to a file Name without file extension or path - MyFile
or if only a path is present, with no trailing backslash, the last folder in that path.
%~x1 Expand %1 to a file eXtension only - .txt
%~s1 Change the meaning of f, n, s and x to reference the Short 8.3 name (if it exists.)
%~1 Expand %1 removing any surrounding quotes (")
%~a1 Display the file attributes of %1
%~t1 Display the date/time of %1
%~z1 Display the file size of %1
%~$PATH:1 Search the PATH environment variable and expand %1 to the fully qualified name of the first match found.The modifiers above can be combined:
%~dp1 Expand %1 to a drive letter and path only.
%~sp1 Expand %1 to a path shortened to 8.3 characters.
%~nx2 Expand %2 to a file name and extension only. -
sztanozs
veterán
-
sztanozs
veterán
Powershell:
$A510="c:\temp\A510\"
$fullstamp="2023-02-28"
$b_backup="\\server\backup"
Get-ChildItem $A510 -recurse -Filter *.* | ForEach-Object {
if ($_.Attributes -ne "Directory") {
if ($_.Length -gt 0) {
Start-Process -WorkingDirectory $A510 -FilePath "c:\Program Files (x86)\7-Zip\7z.exe" -ArgumentList "a `"$($b_backup)$($fullstamp).zip`" `"$($_.Directory)\$($_.Name)`"" -Wait
}
}
} -
sztanozs
veterán
Ez nekem mukodik x86-bol:
@echo off
set "A510=c:\temp\py"
set "fullstamp=2023-02-28"
set "b_backup=\\server\backup"
IF EXIST "%A510%" (
FORFILES /P "%A510%" /S /M *.* /C "cmd /S /C if @isdir==FALSE if @fsize GTR 0 0x22c:\Program Files 0x28x860x29\Microsoft Visual Studio\Shared\Python39_64\python.exe0x22 -c 0x22print(r'%b_backup%\%fullstamp%.zip @file')0x22"
)Kimenet:
\\server\backup\2023-02-28.zip certificates.py
\\server\backup\2023-02-28.zip search_dump.py
^CTerminate batch job (Y/N)? -
csadi0011
őstag
Nem értettem, hogy nekem miért volt jó. Én kicsit tisztítottam a programodon, hogy könnyebben átlássam.
Most kipróbáltam az egészet és nekem is ezt az unexpected hibát írja.
Azif
nem jó. Ha átírtam pl. így:if @fsize GTR 0
vagy kitöröltem, akkor jó volt.
Próbálgattam az if-et, de szám bemenettel vagy logikai vizsgálat nélkül parancssorból és scriptből sem működött. Viszont akkor hogyan futott le neked eddig másik mappából? -
sztanozs
veterán
Oh, nem olvastam el:
To include special characters in the command line, use the hexadecimal code for the character in 0xHH format (ex. 0x09 for tab). Internal CMD.exe commands should be preceded with "cmd /c".
talan igy:IF EXIST "%A510%" (
FORFILES /P "%A510%" /S /M *.* /C "cmd /C if @isdir==FALSE if @fsize 0x22c:\Program Files 0x28x860x29\7-Zip\7z.exe0x22 a %b_backup%\%fullstamp%.zip @FILE"
) -
sztanozs
veterán
fyki:
If /C or /K is specified, then the remainder of the command line after
the switch is processed as a command line, where the following logic is
used to process quote (") characters:
1. If all of the following conditions are met, then quote characters
on the command line are preserved:
- no /S switch
- exactly two quote characters
- no special characters between the two quote characters,
where special is one of: &<>()@^|
- there are one or more whitespace characters between the
two quote characters
- the string between the two quote characters is the name
of an executable file.
2. Otherwise, old behavior is to see if the first character is
a quote character and if so, strip the leading character and
remove the last quote character on the command line, preserving
any text after the last quote character.talan igy jo lesz:
IF EXIST "%A510%" (
FORFILES /P "%A510%" /S /M *.* /C "cmd /C "if @isdir==FALSE if @fsize "c:\Program Files (x86)\7-Zip\7z.exe" a %b_backup%\%fullstamp%.zip @FILE"
) -
Hege1234
addikt
ne félj a sok idézőjeltől..
max ezt próbáld meg beletenni amit eddig csináltál
\"\"c:\Program Files (x86)\7-Zip\7z.exe\"\"
@echo off
set "A510=c:\temp\A510"
set "fullstamp=2023-02-28"
set "b_backup=\\server\backup"
IF EXIST "%A510%" (
FORFILES /P "%A510%" /S /M *.* /C "cmd /C if @isdir==FALSE if @fsize \"\"c:\Program Files (x86)\7-Zip\7z.exe\"\" a %b_backup%\%fullstamp%.zip @FILE"
)ha sehogy nem működne, valahol a gépemen van régebbről olyan script ahol használom kb ugyan így a c:\Program Files (x86) -ot ahogy te akarod majd megpróbálom megkeresni..
-
sonar
addikt
Azt próbálgatom még, hogy az egész Program Files stringet hex-ben adom meg, de úgy sem jó. (természetesen az összes escapelési kombóval kipróbáltam.
IF EXIST %A510% FORFILES /P %A510% /S /M *.* /C "cmd /C if @isdir==FALSE if @fsize 0x220x630x3a0x5c0x500x720x6f0x670x720x610x6d0x200x460x690x6c0x650x730x200x280x780x380x360x290x5c0x370x2d0x5a0x690x700x5c0x370x7a0x2e0x650x780x650x22 a %b_backup%\%fullstamp%.zip @PATH"
"c:\Program Files (x86)\7-Zip\7z.exe" was unexpected at this time.
-
csadi0011
őstag
Nekem nem működik a
\"
féle megoldás, de stackoverflow-on írtak"
helyett^0x22
-t. A forfiles leírásában egyébként benne is van, hogy lehet így helyettesíteni karaktereket, de nem gondoltam volna, hogy az idézést is kell.IF EXIST %A510% FORFILES /P %A510% /S /M *.* /C "cmd /C if @isdir==FALSE if @fsize ^0x22c:\Program^ Files^ ^(x86^)\7-Zip\7z.exe^0x22 a %b_backup%\%fullstamp%.zip @FILE"
Egyébként rakhatod idézőjelbe a set utáni részt, ahogy Hege1234 írta.
-
Hege1234
addikt
nem lehet, hogy a " " hiánya lesz a hiba?
set "A510=c:\temp\A510"
set "fullstamp=2023-02-28"
set "b_backup=\\server\backup"
IF EXIST "%A510%" (
FORFILES /P "%A510%" /S /M *.* /C "cmd /C if @isdir==FALSE if @fsize "c:\Program Files (x86)\7-Zip\7z.exe" a %b_backup%\%fullstamp%.zip @FILE"
) -
ArchElf
addikt
VBS jóval egyszerűbb volna, mint a sima batch.
Set objArgs = WScript.Arguments
Set fso = CreateObject("Scripting.FileSystemObject")
Set fslog = fso.OpenTextFile("c:\dellog.txt", 8, True, -1)
'4 nappal korábbi dátum
DelDate = DateAdd("m", -4, Date)
For Each fF In objArgs
On Error Goto eh:
Set Folder = fso.GetFolder(fF)
Set fFiles = folder.Files
For Each file In fFiles
If (file.DateLastModified < DelDate) Then
file.Delete(True)
fslog.WriteLine "Törölve: "& file.Path
End If
Next
Goto ehe:
eh:
fslog.WriteLine "Hibás könyvtárnév: " & fF
ehe:
Next
fslog.CloseRemélem nincs benne hiba...
AE
-
sec0nd
tag
Bocsi, ha hülyén fejezem ki magam!
Van egy xy.exe-m.
Ha csak simán elindítom, akkor nem nyílik meg helyesen a program, mert gondolmom a C:\User\felhasználónevemből nyitja meg, de a program mappája : "B:\xy\"
És a programnak van egy ini fájlja, gondolom az a C:\User\felhasználónevemben keresi, mert a parancssor azt írja ki.És ha a programhoz létrehozok egy parancsikont, ott is van egy ilyen érték:
Start in: "B:\xy\xy.exe"Szerintem ezt a "start in"-t át kéne átvinni batchbe, hogy ott keresse a konfigurációs fileját a proginak.
Köszönöm, h. megértő, és segítő vagy!
-
sentinel
aktív tag
Hali,
köszi! Van egy batch fájl amit vissza akarok fejteni pontosan mit is csinál. Az ok amit mondasz és értem is, na de google-val hogy keressek rá?? Már tettem idézőjelbe is, stb, de tényleg nem veszi figyelembe sem pl ezt sem--->>>> %%~dpntxH
Meg ilyenek: 2>>&1
Pedig ez valami speckó parancs lehet. Nemtom, pl levág valamit egy karakterből stb...
Új hozzászólás Aktív témák
- Elektromos autók - motorok
- One otthoni szolgáltatások (TV, internet, telefon)
- Samsung Galaxy S23 és S23+ - ami belül van, az számít igazán
- AMD Ryzen 9 / 7 / 5 7***(X) "Zen 4" (AM5)
- Videó stream letöltése
- GeForce RTX 5050 kártyák az MSI portfóliójából
- A fociról könnyedén, egy baráti társaságban
- exHWSW - Értünk mindenhez IS
- Bittorrent topik
- Melyik tápegységet vegyem?
- További aktív témák...
- Bomba ár! HP EliteBook 840 G5 - i5-8G I 8GB I 128GB SSD I 14" FHD Touch I HDMI I Cam I W11 I Gari!
- Erő és sebesség? Most az Öné lehet! Ráadásul kamatmentes rèszletre is!
- Honor 400 Lite 256GB Kártyafüggetlen 1Év Garanciával
- LG 27GP95RP - 27" Nano IPS - UHD 4K - 160Hz 1ms - NVIDIA G-Sync - FreeSync Premium PRO - HDR 600
- ÁRGARANCIA!Épített KomPhone Ryzen 7 7800X3D 32/64GB RAM RX 9070 XT GAMER PC termékbeszámítással
Állásajánlatok
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest
Cég: CAMERA-PRO Hungary Kft
Város: Budapest