- Megerősíti a platformfüggetlen sugárkövetéses tesztjét a 3DMark
- A Seenda ollós klaviatúrája a Microsoft Sculpt Ergonomic Keyboard nyomdokain jár
- Gamescom 2025: Itt a legújabb Gaming NUC
- Cicomától mentes Palit GeForce RTX 5060 a kevésbé tágas gépházak gazdáinak
- Eldőlt: nem építhetnek hátsó kaput az Apple termékekbe a britek
- Kormányok / autós szimulátorok topikja
- Azonnali notebookos kérdések órája
- Fejhallgató erősítő és DAC topik
- Videós, mozgóképes topik
- Milyen asztali (teljes vagy fél-) gépet vegyek?
- Sony MILC fényképezőgépcsalád
- Milyen belső merevlemezt vegyek?
- Milyen egeret válasszak?
- Októberben hozza PC-s kézikonzoljait a Microsoft
- AMD Navi Radeon™ RX 9xxx sorozat
Új hozzászólás Aktív témák
-
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
-
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. -
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. -
-
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
}
}
} -
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 @fsize
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? -
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"
) -
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
Hirdetés
- Samsung Galaxy S25 Edge - a tegnap határán
- exHWSW - Értünk mindenhez IS
- Nők, nőügyek (18+)
- Battlefield 6
- One otthoni szolgáltatások (TV, internet, telefon)
- Linux felhasználók OFF topikja
- Kormányok / autós szimulátorok topikja
- D1Rect: Nagy "hülyétkapokazapróktól" topik
- Azonnali notebookos kérdések órája
- Építő/felújító topik
- További aktív témák...
- Számítógép, ryzen 5 2600, RX 580 8GB, 16gb ddr4, 512gb ssd, 1tb hdd
- HP EliteBook 850 G8 Fémházas Multimédiás Laptop 15,6" -65% i7-1185G7 16/512 Iris Xe FHD
- Gigabyte GeForce GTX 1660 Ti OC hibátlan, dobozos, 14 nap személyes garanciával
- HP EliteBook 850 G8 Fémházas Multimédiás Laptop 15,6" -65% i7-1185G7 32/512 Iris Xe FHD
- Playstation 5 Lemezes kiadás!
- HIBÁTLAN iPhone 13 Pro 128GB Alphine Green -1 ÉV GARANCIA - Kártyafüggetlen, MS3024, 91% Akkumulátor
- DELL Precision 7730 i5-8400H Quadro P3200 16GB 512GB FHD 17 1 év garancia
- GYÖNYÖRŰ iPhone 12 Pro Max 256GB Graphite -1 ÉV GARANCIA - Kártyafüggetlen, MS2927, 100% Akkumulátor
- BESZÁMÍTÁS! Asus H370 i5 9600KF 16GB DDR4 512GB SSD RTX 2060 Super 8GB Zalman N4 ADATA 600W
- Wacom Cintiq DTK-2260 digitális rajztábla
Állásajánlatok
Cég: FOTC
Város: Budapest