Search found 559 matches

by miskox
10 Oct 2023 10:32
Forum: DOS Batch Forum
Topic: Variable inside an IF not showing correctly
Replies: 18
Views: 105607

Re: Variable inside an IF not showing correctly

Code: Select all

set wkdir=%cd%
			Echo "wRkdir = -" !wRkdir!
wkdir and wRkdir variables.

Saso
by miskox
08 Oct 2023 10:00
Forum: DOS Batch Forum
Topic: I'd like to start Filezilla on a network PC
Replies: 5
Views: 15175

Re: I'd like to start Filezilla on a network PC

Maybe you could use CURL or FTP?

Saso
by miskox
08 Oct 2023 09:52
Forum: DOS Batch Forum
Topic: Is there a way to subtract 2 days from this batch file?
Replies: 5
Views: 15916

Re: Is there a way to subtract 2 days from this batch file?

I have these two date functions (I really don't remember where I found them - I did not write them). But one does not work as intented. I used one to add 7 days to calculate dates (for wednesdays) but at one time there were errors: date_calc_error.cmd @echo off set start_dd=21 set start_mm=12 set st...
by miskox
30 Jul 2023 23:46
Forum: DOS Batch Forum
Topic: If...Then Not Working
Replies: 4
Views: 1905

Re: If...Then Not Working

Code: Select all

@echo off
set "StrAJ=ABCDEFGHIJ"
set /p CName="Please enter new customer as LastName, FirstName: "
set "CLetter=%CName:~0,1%"

set "CGroup=Client Files K-Z"
(echo,%StrAJ% | findstr /i "%CLetter%" >nul)&&set "CGroup=Client Files A-J"
echo,%CGroup%
pause
by miskox
27 Jul 2023 04:07
Forum: DOS Batch Forum
Topic: How to detect in 7-Zip fatal error #2 "Wrong password" in windows batch?
Replies: 2
Views: 1690

Re: How to detect in 7-Zip fatal error #2 "Wrong password" in windows batch?

I tested it with 7za.exe (console version on 7zip website). If there is an error (maybe just wrong password or any other - can't tell - didn't check that) ERRORLEVEL was set to 2. If OK ERRORLEVEL was 0.

Code: Select all

7za.exe t -pWRONGPASS test.7z >nul 2>nul
echo %errorlevel%
Saso
by miskox
09 Jul 2023 22:56
Forum: DOS Batch Forum
Topic: Inserting comment within a broken line - is it possible? [WORKAROUND]
Replies: 8
Views: 2515

Re: Inserting comment within a broken line - is it possible?

Here is a test: @echo off echo ---------- sort by extension dir /b /oe echo ---------- sort by extension does not work dir /b REM comment /oe echo ----------end c:\temp>test.cmd ---------- sort by extension test.cmd 3.pdf 2.pdf 1.pdf ---------- sort by extension does not work 1.pdf 2.pdf 3.pdf test....
by miskox
04 Jul 2023 04:19
Forum: DOS Batch Forum
Topic: Inserting comment within a broken line - is it possible? [WORKAROUND]
Replies: 8
Views: 2515

Re: Inserting comment within a broken line - is it possible?

DOSadnie wrote:
04 Jul 2023 03:42
...but also time consuming...
I guess not because you usually do it only once.

Saso
by miskox
04 Jul 2023 04:18
Forum: DOS Batch Forum
Topic: Inserting comment within a broken line - is it possible? [WORKAROUND]
Replies: 8
Views: 2515

Re: Inserting comment within a broken line - is it possible?

renders my script half-workihg, because it only creates a backup of the folder structure omitting all of the files I think the reason why it will not work is this: some_command /a /b /c /d will work. But if I add a comment: some_command /a /b^ REM some comment /c /d equals to: some_command /a /b RE...
by miskox
03 Jul 2023 10:47
Forum: DOS Batch Forum
Topic: Inserting comment within a broken line - is it possible? [WORKAROUND]
Replies: 8
Views: 2515

Re: Inserting comment within a broken line - is it possible?

Maybe you could write comments like this: robocopy "%sd%" "%dd%\%folder_name%" /E /XF "%sd%\desktop.ini" REM | | | | | REM | | | | \- comment 1 REM | | | \----------- comment 2 REM | | \-------------- comment 3 REM | \-- comment 4 (not right justifed) REM \-- comment 5 (not right justifed for exampl...
by miskox
30 Jun 2023 05:55
Forum: DOS Batch Forum
Topic: NetBazmek - Windows networking subsytem helper
Replies: 3
Views: 2213

Re: NetBazmek - Windows networking subsytem helper

Nice work. I get some errors but this script is very useful.

(will check again and write down errors)

Saso
by miskox
27 Jun 2023 10:11
Forum: DOS Batch Forum
Topic: How to escape comma in wmic?
Replies: 10
Views: 4762

Re: How to escape comma in wmic?

Very good idea! Congratulations!

Saso
by miskox
27 Jun 2023 10:09
Forum: DOS Batch Forum
Topic: Is there a script to safely delete a file?
Replies: 3
Views: 1504

Re: Is there a script to safely delete a file?

You have to open the existing file for read/write and set a filepointer to the beginning of it. So you need filepointer (see https://www.dostips.com/forum/viewtopic.php?f=3&t=5552&p=34051#p34051). So this means 3rd party program. In this case sdelete is your best option. Maybe someone has a better i...