Search found 3859 matches

by Squashman
11 Nov 2018 19:44
Forum: DOS Batch Forum
Topic: Find files and parse them in the command line
Replies: 2
Views: 38

Re: Find files and parse them in the command line

Use the DIR or FOR commands to find the files you want. The FIND command is used to find string inside text files.
by Squashman
11 Nov 2018 19:41
Forum: DOS Batch Forum
Topic: Display commands only if file exists
Replies: 2
Views: 34

Re: Display commands only if file exists

At the top of your script use the ECHO command to turn off verbose output of other command.

Code: Select all

@echo off
by Squashman
09 Nov 2018 10:45
Forum: DOS Batch Forum
Topic: Writing Batch code in an easier way with the aid of macros
Replies: 16
Views: 1645

Re: Writing Batch code in an easier way with the aid of macros

Hi, You wrote me : The value of the variable option is not a valid command. Why is it not a valid command, as to call a batch macro the usual form is %macro% ? In this case why is %option% form not valid ? Thanks for answer Insert, Delete and Update are NOT VALID commands. They do not EXIST! Try ty...
by Squashman
09 Nov 2018 10:13
Forum: DOS Batch Forum
Topic: Rename Files in Dir
Replies: 1
Views: 29

Re: Rename Files in Dir

Code: Select all

set app=%app:KILLERS=%
So what do you think you have to change in this line of code?
by Squashman
09 Nov 2018 09:55
Forum: DOS Batch Forum
Topic: Writing Batch code in an easier way with the aid of macros
Replies: 16
Views: 1645

Re: Writing Batch code in an easier way with the aid of macros

bocsi6 wrote:
09 Nov 2018 09:44
Hi, Aacini,
You wrote as a simple batch macro :

set /P option=Enter the desired option [Insert,Delete,Update]:
goto %option%

Why did you have to use
Goto %option%
instead of simply
%option% ?
The value of the variable option is not a valid command.
by Squashman
08 Nov 2018 18:50
Forum: DOS Batch Forum
Topic: batch script for deleting files 90 days older
Replies: 5
Views: 68

Re: batch script for deleting files 90 days older

Hi, I tried this with the local path, it worked perfectly fine. But when given a share drive path, it shows me an error as Error: UNC paths (\\machine\share) are not supported. here is What I am trying. SET "NASS=\\abc" SET "TEMPDIR=!NASS!\CU\OR" forfiles /p "%TEMPDIR%\OR" /s /m *.* /c "cmd /c Del ...
by Squashman
08 Nov 2018 14:52
Forum: DOS Batch Forum
Topic: in a for loop just 2 kind of extentions
Replies: 4
Views: 33

Re: in a for loop just 2 kind of extentions

I always use an UPPERCASE G for my FOR variable. The FOR variable is case sensitive. It also helps with visually identifying which letters are the command modifiers and which one is the FOR variable.
by Squashman
08 Nov 2018 14:26
Forum: DOS Batch Forum
Topic: in a for loop just 2 kind of extentions
Replies: 4
Views: 33

Re: in a for loop just 2 kind of extentions

You were close.
You can do this two ways.

Code: Select all

FOR %%G IN (*.avi *.mov) do .....
or

Code: Select all

FOR /F "delims=" %%G IN ('dir /a-d /b *.avi *.mov') do....
by Squashman
05 Nov 2018 18:16
Forum: DOS Batch Forum
Topic: Replace node value in multiple xml files
Replies: 7
Views: 123

Re: Replace node value in multiple xml files

You should using a scripting language that has a native method to read and write XML. Vbscript, Jscript or Powershell.
by Squashman
03 Nov 2018 06:14
Forum: DOS Batch Forum
Topic: Code snippet inadvertently prevents console title renaming
Replies: 3
Views: 95

Re: Code snippet inadvertently prevents console title renaming

Just tried your code and made the first line of the code be a TITLE statement. Then put more TITLE statements in the code.
The Window Title changed every time.
by Squashman
02 Nov 2018 14:14
Forum: DOS Batch Forum
Topic: Foxidrive has left us
Replies: 24
Views: 5244

Re: Foxidrive has left us

Squashman wrote:
02 Nov 2017 08:50
Well it is technically November 3rd in Australia......

Still have not forgotten about you! Hope you are in a good place living out eternity and partying like its 1999.
by Squashman
01 Nov 2018 14:19
Forum: DOS Batch Forum
Topic: My batch Menu
Replies: 9
Views: 210

Re: My batch Menu

Thank you, I might look into those things in the future as I am currently focused on adding new features. If you have any suggestions, please let me know. I would suggest you take the advice and learn to program it more efficiently before adding more features. Your code is already a couple hundred ...
by Squashman
31 Oct 2018 12:52
Forum: DOS Batch Forum
Topic: I NEED THE PRECISE DATE FOR MY BATCH FILE
Replies: 4
Views: 135

Re: I NEED THE PRECISE DATE FOR MY BATCH FILE

And one line of code if you call out to Powershell.

Code: Select all

powershell "(Get-Date).ToString('TODAY IS dddd dd MMMM yyyy')"
by Squashman
31 Oct 2018 12:21
Forum: DOS Batch Forum
Topic: Delete everything in txt after fifth slash
Replies: 2
Views: 80

Re: Delete everything in txt after fifth slash

Two options for you in this code. Use the question mark as the delimter or use the forward slash as the delimiter. @echo off FOR /F "tokens=1 delims=?" %%G IN (a.txt) do echo %%G echo ---------------------------------------------- FOR /F "tokens=1-4 delims=/" %%G IN (a.txt) do echo %%G//%%H/%%I/%%J/...