Hirdetés
- Fejhallgató erősítő és DAC topik
- Hobby elektronika
- Apple MacBook
- Házimozi belépő szinten
- Milyen asztali (teljes vagy fél-) gépet vegyek?
- Hisense LCD és LED TV-k
- Amazon Fire TV stick/box
- AMD Ryzen 9 / 7 / 5 9***(X) "Zen 5" (AM5)
- Egy fontos tényező akadályozhatja a csúcstechnológiás chipgyártást az USA-ban?
- Szünetmentes tápegységek (UPS)
Ú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
- Apple iPhone 16 Pro - rutinvizsga
- iPhone topik
- Kerékpárosok, bringások ide!
- Építő/felújító topik
- Sokkal drágább lett az „olcsó” Tesla, mint várták
- Mobil flották
- f(x)=exp(x): A laposföld elmebaj: Vissza a jövőbe!
- Kertészet, mezőgazdaság topik
- PROHARDVER! feedback: bugok, problémák, ötletek
- Kuponkunyeráló
- További aktív témák...
- Western Digital WD Purple 4TB - WD40PURZ - Új, bontatlan - Eladó!
- WD Black SN850P 4TB M.2 NVME PCI-E 4.0 x4 - Új - 7300-6600 MBs - Eladó!
- Fujitsu Lifebook A357 (i3 6th, 8 GB 250 GB FHD) laptop leárazás!!! AkciÓÓ!
- ÚJ! GAMER PC I5-14600KF RX 9060XT 16GB RTX 5060Ti 16GB RTX 5070Ti 16GB RTX 5080 32/64GB DDR5 számlás
- Vivobook Pro 15 N6506MV 15.6" QHD+ OLED Ultra 9 185H RTX 4060 24GB 1TB NVMe IR kam gar
- ÁRGARANCIA!Épített KomPhone i5 13400F 16/32/64GB RAM RTX 5060 Ti 8GB GAMER PC termékbeszámítással
- Honor X7 128GB, Kártyafüggetlen, 1 Év Garanciával
- BESZÁMÍTÁS! ASUS PRIME H510M i5 10400F 16GB DDR4 512GB SSD RX 6600 XT OC 8GB CHIEFTEC Libra 600W
- Samsung Galaxy S23 5G 128GB, Kártyafüggetlen, 1 Év Garanciával
- ÁRGARANCIA!Épített KomPhone i5 10400F 16/32GB RAM RTX 3060 12GB GAMER PC termékbeszámítással
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest