Search found 174 matches

by sambul35
16 Feb 2016 12:02
Forum: DOS Batch Forum
Topic: Combine IF statetement with AND/OR
Replies: 2
Views: 3050

Combine IF statetement with AND/OR

This Cmd Syntax reference page says, piping commands is possible in IF statements like this: IF (... | ...) Does it actually work in Win 10 Cmd batches? Can you give a working code example? Is there a similar way in a batch to process AND/OR multiple conditions inside one IF statement instead of rep...
by sambul35
16 Feb 2016 11:08
Forum: DOS Batch Forum
Topic: Catching User Input on "Terminate batch job (Y/N)?" prompt
Replies: 7
Views: 7517

Catching User Input on "Terminate batch job (Y/N)?" prompt

Hello guys, I was looking for a simple way to catch user input after Crtl+C is pressed and Terminate batch job (Y/N)? prompt is shown in a Win 10 Cmd window, but amazingly can't find any on the web. For example, depending on user input: if "y" command1 else if "n" command2 What v...
by sambul35
22 Jan 2012 09:27
Forum: DOS Batch Forum
Topic: Using Findstr to separate a line with "Empty" character
Replies: 3
Views: 4338

Re: Using Findstr to separate a line with "Empty" character

Thanks a lot - it works on Eng system too! So, now I have for the above example: set sce=diskpart /s scenario.txt FOR /F "tokens=2,3 delims= " %%A IN ('%%sce%%|findstr /rc:"^ Volume [0-9][0-9]* "') do (set vld=!vld! %%A & set lbl=!lbl! %%B) echo %vld% %lbl% It prints: 9 11 Te...
by sambul35
21 Jan 2012 20:29
Forum: DOS Batch Forum
Topic: Using Findstr to separate a line with "Empty" character
Replies: 3
Views: 4338

Using Findstr to separate a line with "Empty" character

I got this result from Diskpart -> List Disk -> Select Disk 5 -> Detail Disk command: Volume 8 F Windows Sev NTFS Partition 422 MB Healthy System Volume 9 Test1 NTFS Partition 100 MB Healthy Volume 10 G Test3 NTFS Partition 49 GB Healthy Volume 11 FAT32 Partition 0 B Healthy Volume 12 H DS1 NTFS Par...
by sambul35
21 Jan 2012 14:05
Forum: DOS Batch Forum
Topic: Count empty drive letters
Replies: 7
Views: 6561

Re: Count empty drive letters

Sorry guys for repeating my question.

Can someone suggest a batch to list unmounted volume numbers or GUIDs for a given drive (disk 3 or GUID...) with Diskpart or WMIC? I mean, not a sample that lists mounted volumes without linking them to physical disks, but the code as requested? :)
by sambul35
18 Jan 2012 17:07
Forum: DOS Batch Forum
Topic: Count empty drive letters
Replies: 7
Views: 6561

Re: Count empty drive letters

Thanks, that will do. :D

I'm kind of new to batch files, so may ask stupid questions. Once I debugged the batch, how I can convert it to .exe file (possibly encrypted), so that it can be executed in Win7 32/64-bit Command Prompt, but its content would be harder to read?
by sambul35
18 Jan 2012 12:20
Forum: DOS Batch Forum
Topic: Count empty drive letters
Replies: 7
Views: 6561

Re: Count empty drive letters

That's fine. May be you can suggest another issue:

When a user is prompted for input with Set /p to enter file name, how to type a suggested file name on screen that the user can directly edit by typing?
by sambul35
18 Jan 2012 11:15
Forum: DOS Batch Forum
Topic: Count empty drive letters
Replies: 7
Views: 6561

Re: Count empty drive letters

Thanks, Its not exactly what I asked for (I wanted to limit the list to a subset of unmounted volumes on a selected disk), but...may be next time. As to been consufed, not exactly. The problem is, when a Vdisk is unmounted, its volumes retain drive letters, and can be automounted next time the vdisk...
by sambul35
18 Jan 2012 10:22
Forum: DOS Batch Forum
Topic: Count empty drive letters
Replies: 7
Views: 6561

Count empty drive letters

Hello guys, great forum! Diskpart command can Detail Disk #, printing on screen list of its volumes with Volume # and DriveLetter for each. Some volumes aren't mounted, so don't have DriveLetter. What's the best way to list and save unmounted volume numbers for a selected disk to variables? Also, is...