Search found 41 matches
- 23 Oct 2023 16:07
- Forum: DOS Batch Forum
- Topic: Adding a new DosKey command
- Replies: 4
- Views: 15990
Re: Adding a new DosKey command
Thanks, but that didn't work either (it gave the same 'not recognized' message). However, I have managed to find the problem ..... (me!). I had recently connected a backup drive that has the same layout as my main drive, and somehow the shortcut that contains my startup config and autorun script dec...
- 23 Oct 2023 13:53
- Forum: DOS Batch Forum
- Topic: Adding a new DosKey command
- Replies: 4
- Views: 15990
Adding a new DosKey command
I have an 'autorun' script that gets called whenever I start a cmd session. In this file I have (among other things) various doskey commands such as: doskey dh=echo(^&dir /a:h /o:g doskey sid=echo(^&wmic useraccount get name,sid doskey dkh=echo(^&doskey /history ^| more doskey fon-=echo(^& echo Font...
- 23 Oct 2023 05:27
- Forum: DOS Batch Forum
- Topic: [SOLVED] Validating user input against the content of a text file
- Replies: 3
- Views: 16997
Re: Validating user input against the content of a text file
Remove one space in your code line 29. if "!valid_disks: %disk%=!"=="!valid_disks!" ( Wow, thank you! Who knew that one space could cause such problems? I removed the space and everything now works correctly. Your code creates variable valid_disks with all valid disknumbers separated by spaces. You...
- 21 Oct 2023 21:14
- Forum: DOS Batch Forum
- Topic: [SOLVED] Validating user input against the content of a text file
- Replies: 3
- Views: 16997
[SOLVED] Validating user input against the content of a text file
I am trying to semi-automate a diskpart command, and then have the output of this command formatted to my liking. I am very inexperienced with command line stuff, but I have managed to get some code together using various online examples (rather than me writing it myself). It works and it does exact...
- 10 Dec 2022 04:58
- Forum: DOS Batch Forum
- Topic: Can't change directory using cmd script
- Replies: 2
- Views: 8555
Re: Can't change directory using cmd script
Thank you! I switched to ANSI and it seems to have done the trick. I'm not sure how it got changed (because I've been using that script for a while before it broke). Anyway, now that I can run cd commands again, I can get back to trying to deal with the issue that I was trying to resolve in the firs...
- 08 Dec 2022 02:08
- Forum: DOS Batch Forum
- Topic: Can't change directory using cmd script
- Replies: 2
- Views: 8555
Can't change directory using cmd script
I can change directory fine if I manually type cd into cmd window, but I cannot get any cd command to work from a cmd file. I know that I must be overlooking something basic and glaringly obvious, but I can't figure out what's going on. For example: If I type cd /d "C:\Windows" at the command prompt...
- 07 Dec 2022 12:50
- Forum: DOS Batch Forum
- Topic: Putting code output into a variable for string matching
- Replies: 4
- Views: 6190
Re: Putting code output into a variable for string matching
Wow, thank you so much for this! It works like a charm, and I've now got it doing exactly what I want. I would have never been able to figure this out for myself. By the way, I'm not actually using Light Aqua - lol. I'm running a specific console session via a Start Menu shortcut (for which I've man...
- 07 Dec 2022 02:41
- Forum: DOS Batch Forum
- Topic: Putting code output into a variable for string matching
- Replies: 4
- Views: 6190
Re: Putting code output into a variable for string matching
Thank you for your reply. I did initially assume that %%# was the variable (given its position within the output) but I couldn't even get it to echo its contents on screen, nevermind do anything else with it. How would I store the contents of %%# into my own named variable? I just want to be able to...
- 06 Dec 2022 15:56
- Forum: DOS Batch Forum
- Topic: Putting code output into a variable for string matching
- Replies: 4
- Views: 6190
Putting code output into a variable for string matching
I need to be able to distinguish between two command line windows based on the text color that they use. I found some code online that does this, but I have very limited experience with command line stuff and this particular code example is utterly impenetrable to me. @(Set/P "=The color is currentl...
- 03 Nov 2018 15:12
- Forum: DOS Batch Forum
- Topic: Code snippet inadvertently prevents console title renaming
- Replies: 3
- Views: 4736
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. Thank you for letting me know the result of your testing, Squashman. It seems as if these things are never as straight-forward as I imagine...
- 03 Nov 2018 02:51
- Forum: DOS Batch Forum
- Topic: Code snippet inadvertently prevents console title renaming
- Replies: 3
- Views: 4736
Code snippet inadvertently prevents console title renaming
I've been experimenting setting up different console sessions (configured for different purposes) using basic commands like title, color, prompt etc. via the cmd.exe /K switch. After much trial and error (mainly error) I mostly got things working as I wanted. However there were certain instances whe...
- 28 Oct 2018 16:44
- Forum: DOS Batch Forum
- Topic: Getting >nul 2>&1 to work within a batch file
- Replies: 12
- Views: 15172
- 28 Oct 2018 10:11
- Forum: DOS Batch Forum
- Topic: Getting >nul 2>&1 to work within a batch file
- Replies: 12
- Views: 15172
Re: Getting >nul 2>&1 to work within a batch file
This should work: doskey closeall=taskkill /IM "cmd.exe" /f ^>nul 2^>^&1 Thank you SO much, Antonio. This works perfectly, and it's exactly what I wanted. 8) This time I will make a careful note of how it's done, so that I can use it as a template guide for achieving a similar effect for other comm...
- 28 Oct 2018 01:53
- Forum: DOS Batch Forum
- Topic: Getting >nul 2>&1 to work within a batch file
- Replies: 12
- Views: 15172
Re: Getting >nul 2>&1 to work within a batch file
You can, however, set "closeall=taskkill /IM "cmd.exe" /f >nul 2>&1" %closeall% Thank you, This now hides the output, but in order to get it to work I have to type %closeall% including the percentage marks. How can I get it to work with just the word closeall on its own? I had a similar issue to th...
- 27 Oct 2018 17:48
- Forum: DOS Batch Forum
- Topic: Getting >nul 2>&1 to work within a batch file
- Replies: 12
- Views: 15172
Getting >nul 2>&1 to work within a batch file
How do I get the following command to work from within a batch file? doskey closeall=taskkill /IM "cmd.exe" /f >nul 2>&1 I want the output of taskkill to be suppressed. It works perfectly if typed at the command line, but when the above command is used in a batch file, you still see the output text ...