Search found 553 matches

by miskox
02 Jan 2023 08:53
Forum: DOS Batch Forum
Topic: How to loop through drive letters to run my script
Replies: 16
Views: 17862

Re: How to loop through drive letters to run my script

I suspect that your second .ahk file is not there (I guess you don't check for the existence of both .ahk files). Please execute this and provide the output: test.cmd: @echo off for %%f in (C D E F) do echo ---&dir %%f:\Dropbox\AHK\Autohotkey.ahk&dir %%f:\Dropbox\AHK\TextExpansion.ahk pause You coul...
by miskox
02 Jan 2023 08:49
Forum: DOS Batch Forum
Topic: Help with if / loop and variables
Replies: 9
Views: 24244

Re: Help with if / loop and variables

I agree with aGerman: user enters the data and all you have to do is use FIND or FINDSTR and check for ERRORLEVEL (or && / ||).

This is what you get for not providing all the information in the first place - solution to your problem might be completely different from your first approach.

Saso
by miskox
30 Dec 2022 00:45
Forum: DOS Batch Forum
Topic: How to loop through drive letters to run my script
Replies: 16
Views: 17862

Re: How to loop through drive letters to run my script

Again: see my previous posts: Errors you have are caused because path you have does not exist on every device you have. So you have to use the first version which checks the existence of the files. It is possible that .ahk runs and does not wait until it finishes? (I don't know how .ahk works) This ...
by miskox
29 Dec 2022 05:14
Forum: DOS Batch Forum
Topic: How to loop through drive letters to run my script
Replies: 16
Views: 17862

Re: How to loop through drive letters to run my script

It will go thru all the letters in the FOR command and PAUSE after *each* letter.

Saso
by miskox
27 Dec 2022 05:04
Forum: DOS Batch Forum
Topic: bat file to open workbook
Replies: 1
Views: 6491

Re: bat file to open workbook

You could try this (based on the info I have): Create run_xlsB.cmd (or name it as you wish) in the same folder where your .xlsb files are: @for /f "usebackq" %%f in (`dir /on /b *.xlsb`) do %%f or @for /f "usebackq" %%f in (`dir /on /b *.xlsb`) do start "" %%f See HELP CMD for other options if requi...
by miskox
26 Dec 2022 11:03
Forum: DOS Batch Forum
Topic: How to loop through drive letters to run my script
Replies: 16
Views: 17862

Re: How to loop through drive letters to run my script

Add PAUSE at the end (looks like you double-click on the .cmd/.bat): @for %%f in (C D E F) do echo ---&dir %%f:\Dropbox\AHK\Autohotkey.ahk&dir %%f:\Dropbox\AHK\TextExpansion.ahk&pause If you execute (start) your .ahk file from within the command prompt: does it return to the prompt before it actuall...
by miskox
23 Dec 2022 00:44
Forum: DOS Batch Forum
Topic: How to loop through drive letters to run my script
Replies: 16
Views: 17862

Re: How to loop through drive letters to run my script

'DO' is part of the FOR command and is required: enter FOR /? and you will see: Runs a specified command for each file in a set of files. FOR %variable IN (set) DO command [command-parameters] %variable Specifies a single letter replaceable parameter. (set) Specifies a set of one or more files. Wild...
by miskox
20 Dec 2022 11:25
Forum: DOS Batch Forum
Topic: How to loop through drive letters to run my script
Replies: 16
Views: 17862

Re: How to loop through drive letters to run my script

I don't know how AHK works (their syntax and how you call the scripts) but I guess you could use something like this: This code will check if both .ahk files exist. If *both* exist it will first run first .ahk file and then the second one. @for %%f in (C D E F) do if exist %%f:\Dropbox\AHK\Autohotke...
by miskox
15 Dec 2022 06:35
Forum: DOS Batch Forum
Topic: How to loop through drive letters to run my script
Replies: 16
Views: 17862

Re: How to loop through drive letters to run my script

The code below will go thru letters C..Z:

Code: Select all

@echo off
for %%f in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do echo %%f
Replace echo %%f with the code you want (for example: if exist %%f:\folder_to_file\file_to_check.tmp).

Saso
by miskox
07 Dec 2022 00:24
Forum: DOS Batch Forum
Topic: copy
Replies: 12
Views: 6452

Re: copy

Let me give you this link again: https://www.dostips.com/forum/viewtopic.php?f=3&t=6108 We are all wasting our time because your original post does not (and additional posts) provide enough information. You would probably already have a solution if your original post had all the information required...
by miskox
06 Dec 2022 07:48
Forum: DOS Batch Forum
Topic: copy
Replies: 12
Views: 6452

Re: copy

What happens if you execute your .bat file? (of course remove BOLD tags) @echo off setlocal enabledelayedexpansion for %%A in (*.bat) do ( for /f "delims=" %%B in ("%%A") do set fname=%%~nB for /f "delims=" %%C in ("%%A") do set fextn=%%~xC for /f "tokens=1* delims=_" %%D in ("!fname!") do set folna...
by miskox
05 Dec 2022 04:53
Forum: DOS Batch Forum
Topic: copy
Replies: 12
Views: 6452

Re: copy

%0 returns batch name.

Code: Select all

@echo %0
Saso

P.S. Use code tags, please.
by miskox
05 Dec 2022 01:46
Forum: DOS Batch Forum
Topic: copy
Replies: 12
Views: 6452

Re: copy

viewtopic.php?f=3&t=6108

Maybe you could do this:

Code: Select all

help copy
or

Code: Select all

copy /?
Saso
by miskox
29 Nov 2022 05:13
Forum: DOS Batch Forum
Topic: infinite loop with break condition
Replies: 75
Views: 97140

Re: infinite loop with break condition

Of course. Handle. The moment I turned the computer off I thought of that.

Thanks.
Saso
by miskox
28 Nov 2022 13:46
Forum: DOS Batch Forum
Topic: infinite loop with break condition
Replies: 75
Views: 97140

Re: infinite loop with break condition

Very good findings, Jeb. I remembered that Aacini made a filepointer.exe. Original Steffen's code: @echo off &setlocal EnableDelayedExpansion set "n=0" &echo %time% & set /a "n+=1" :loop if !n! leq 10000 ( set /a "n+=1" ) else goto :exit goto :loop :exit echo %time% %n% &pause With filepointer.exe @...