- Milyen okostelefont vegyek?
- Itthon is kapható lesz a kerámia Xiaomi Band 10
- Vivo V40 5G - az első benyomás fontos
- Hová lett 1000 mAh?
- Fontos fejlesztéssel érkezik a Galaxy A17 5G
- Friss koncepciót hoz a Nothing Phone (3)
- Samsung Galaxy A54 - türelemjáték
- Samsung Galaxy S25 Ultra - titán keret, acélos teljesítmény
- Amazfit Active 2 NFC - jó kör
- Csak semmi szimmetria: flegma dizájnnal készül a Nothing Phone (3)
Ú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 @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? -
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
Hirdetés
- Fortnite - Battle Royale & Save the World (PC, XO, PS4, Switch, Mobil)
- Fogyjunk le!
- f(x)=exp(x): A laposföld elmebaj: Vissza a jövőbe!
- ZIDOO médialejátszók
- Vicces képek
- Milyen okostelefont vegyek?
- Milyen routert?
- Once Human
- TCL LCD és LED TV-k
- A fociról könnyedén, egy baráti társaságban
- További aktív témák...
- Apple iPhone 15 128GB, Kártyafüggetlen, 1 Év Garanciával
- Nintendo Switch bazár (Okosított Nintendo Switch konzolok, játékok, tartozékok)
- Eladó ÚJ, BONTATLAN Samsung Galaxy A05s 4/64GB ezüst / 12 hónap jótállással!
- Azonnali készpénzes nVidia RTX 2000 sorozat videokártya felvásárlás személyesen / csomagküldéssel
- Bomba ár! Lenovo ThinkPad T450s - i5-5GEN I 12GB I 500GB SSD I 14" HD+ I Cam I W10 I Garancia!
Állásajánlatok
Cég: Promenade Publishing House Kft.
Város: Budapest
Cég: PC Trade Systems Kft.
Város: Szeged