Search found 64 matches

by BoQsc
04 May 2019 07:22
Forum: DOS Batch Forum
Topic: Unable to download a file via BITSADMIN, does it also require /DYNAMIC switch?
Replies: 0
Views: 119

Unable to download a file via BITSADMIN, does it also require /DYNAMIC switch?

First, I want to introduce you to a working script, that only downloads when I add /DYNAMIC switch to the BITSADMIN /Transfer command: set "downloadLink=http://www.chrysocome.net/downloads/78057a17668093943717ee3c48c669fb/ddrelease64.exe" bitsadmin /transfer myDownloadJob /download /DYNAMIC /priorit...
by BoQsc
24 Apr 2019 03:16
Forum: DOS Batch Forum
Topic: A question about a command inside a variable
Replies: 3
Views: 231

Re: A question about a command inside a variable

Ok, I've found what's wrong. I needed to escape caret. Old: set "_removeLastWmicLine=findstr /v "^$"" New: set "_removeLastWmicLine=findstr /v "^^$"" Final working code. set "_wmic_command=wmic logicaldisk where "drivetype =2" get VolumeName^, FileSystem^, Description^, Caption" set "_removeLastWmic...
by BoQsc
22 Apr 2019 03:01
Forum: DOS Batch Forum
Topic: A question about a command inside a variable
Replies: 3
Views: 231

Re: A question about a command inside a variable

I made changes according to your critique, but now the output is the same as if I do not pipe wmic command into findstr . The output after I applied your critique comments: 1 K: Removable Disk FAT32 UBUNTU 19_0 2 Press any key to continue . . . The output that I wanted to see: 1 K: Removable Disk FA...
by BoQsc
21 Apr 2019 04:59
Forum: DOS Batch Forum
Topic: A question about a command inside a variable
Replies: 3
Views: 231

A question about a command inside a variable

Here is what I have. Umodified script - works great SETLOCAL EnableDelayedExpansion set "_wmic_command=wmic logicaldisk where "drivetype =2" get VolumeName^, FileSystem^, Description^, Caption" set numOpts=0 FOR /f "usebackq skip=1 tokens=*" %%G IN (`%_wmic_command% ^| findstr /r /v "^$"`) DO ( set ...
by BoQsc
24 Oct 2018 13:35
Forum: DOS Batch Forum
Topic: wmic, overall disk capacity, convert bytes to gb
Replies: 1
Views: 779

wmic, overall disk capacity, convert bytes to gb

Here is a problem: When a single USB is connected, the device capacity in gigabytes are calculated correctly. But, when I tried to connect one more USB flash drive, the newly connected flash drive's capacity is displayed incorrectly. (way bigger) Is this weird only for me? @echo off setlocal enabled...
by BoQsc
25 Sep 2018 00:42
Forum: DOS Batch Forum
Topic: FOR loop does not increment /L %%parameter
Replies: 16
Views: 8604

Re: FOR loop does not increment /L %%parameter

For a second i did though about writting everything in Java instead, as batch has no short concise guidelines on precisely understanding how to write code without getting into troubles. Java is really not designed for system programming, you will need additional libraries and it is one of the most ...
by BoQsc
24 Sep 2018 13:50
Forum: DOS Batch Forum
Topic: FOR loop does not increment /L %%parameter
Replies: 16
Views: 8604

Re: FOR loop does not increment /L %%parameter

floppydisks are also drivetype 2 so you are really searching for any removableDrives. I'm searching only for USB Flash devices, and my own portable HDD is not getting considered as drive type 2. Kind of Strange. That would be great to come up with general easily extendable scripts such as in this t...
by BoQsc
24 Sep 2018 08:34
Forum: DOS Batch Forum
Topic: FOR loop does not increment /L %%parameter
Replies: 16
Views: 8604

Re: FOR loop does not increment /L %%parameter

What this script suppose to do: Return all connected USB drives, so that I could use Gdisk.exe to manipulate, create partitions and so on. Gdisk.exe part is not written yet as I'm stuck with iteration as mentioned on the subject of this thread. The requirements to run the code are simple: The WMI c...
by BoQsc
24 Sep 2018 00:18
Forum: DOS Batch Forum
Topic: FOR loop does not increment /L %%parameter
Replies: 16
Views: 8604

Re: FOR loop does not increment /L %%parameter

EndLocal & ( FOR /L %%i in (0, 1, 2) DO ( Echo %%i - Finally Iterates! Echo %DeviceID[1]% - Manual index placement works perfectly, returns Device ID call Echo %%DeviceID[%%i]%% - Still becomes empty. ❗ Echo %DeviceID[%%i]% - Still becomes empty. ❗ REM commented both of them, still becomes empty re...
by BoQsc
23 Sep 2018 13:52
Forum: DOS Batch Forum
Topic: FOR loop does not increment /L %%parameter
Replies: 16
Views: 8604

Re: FOR loop does not increment /L %%parameter

You have a similar problem here: Set "DeviceID[%%i]=%DeviceID[%%i]: =%" Set "VolumeName[%%i]=%VolumeName[%%i]: =%" You say "Echo %DeviceID[1]% - Manual index placement works perfectly, returns Device ID" But what really happens is Set "DeviceID[x]=%x%%x%" Set "DeviceID[x]=" You've been mislead by t...
by BoQsc
23 Sep 2018 09:30
Forum: DOS Batch Forum
Topic: FOR loop does not increment /L %%parameter
Replies: 16
Views: 8604

Re: FOR loop does not increment /L %%parameter

Your for loop ends with goto :EOF thus telling to abort the for loop and leave the function. Similar as when you would write return inside a java program the function is exited immediately commands behind it will not be executed, loops aborted. You probably expect for x in ( set ) do ( commands ) &...
by BoQsc
23 Sep 2018 08:24
Forum: DOS Batch Forum
Topic: FOR loop does not increment /L %%parameter
Replies: 16
Views: 8604

FOR loop does not increment /L %%parameter

Can someone point out why incrementation do not work, and how to fix it? The part where incrementation do no occur: EndLocal & FOR /L %%i in (0, 1, 2) DO ( echo %%i - Do not increment??? REM Set "DeviceID[%%i]=%DeviceID[%%i]: =%" REM Set "VolumeName[%%i]=%VolumeName[%%i]: =%" ) Full code @Echo off c...
by BoQsc
17 Jun 2018 07:32
Forum: DOS Batch Forum
Topic: include command inside repl.bat
Replies: 0
Views: 1526

include command inside repl.bat

The output I get instead of modified source data: output.txt (Strangely, it redirects the command I want to execute instead of output of that command) C:\Users\user\Desktop>IF ""red\s*\+\s*blue"" == "" (type test.txt | repl "red\s*\+\s*blue" "purple" m ) 1>output.txt The code I added at the top of r...
by BoQsc
18 Mar 2018 14:32
Forum: DOS Batch Forum
Topic: Invisible error, deleting a comment - makes everything work
Replies: 13
Views: 3064

Re: Invisible error, deleting a comment - makes everything work

I find that hard to believe because I just tested that section of code with REM instead of double colon and it all worked for me. I can assure, it does not work when running whole code. And I made every old comment into REM. The code that was fully converted to comments was the whole code, the same...
by BoQsc
18 Mar 2018 14:20
Forum: DOS Batch Forum
Topic: Invisible error, deleting a comment - makes everything work
Replies: 13
Views: 3064

Re: Invisible error, deleting a comment - makes everything work

So you think you don't have to use REM in place of all the double colons? Well I though that if the problem is with that only line - replacing it with REM could at least work . However I have just tested and replaced every :: comment with a REM, but it's Still the same crash. I keep wondering that ...