Search found 1161 matches
- 07 Mar 2023 22:41
- Forum: DOS Batch Forum
- Topic: How to ask for input
- Replies: 2
- Views: 1577
Re: How to ask for input
In this particular case, the line if /I %Drive% geq C & if %Drive% leq Z goto :Next1 is wrong because you can't chain two if statements together with an ampersand. All you have to do is have them one after the other like you do on the previous line. On a somewhat related note, it's pretty much alway...
- 07 Mar 2023 22:30
- Forum: DOS Batch Forum
- Topic: Check File Size Properties
- Replies: 12
- Views: 4357
Re: Check File Size Properties
If all you need is the size of some folder, that's been posted on here before: viewtopic.php?t=9615
- 06 Mar 2023 23:22
- Forum: DOS Batch Forum
- Topic: Check File Size Properties
- Replies: 12
- Views: 4357
Re: Check File Size Properties
I don't understand why you need this. Just right-click the first folder and select Properties, and then right-click the second folder and select Properties. There's no need to bring a script into this at all based on what you've described so far.
- 15 Feb 2023 23:16
- Forum: DOS Batch Forum
- Topic: Automatically uninstall a program
- Replies: 2
- Views: 1660
Re: Automatically uninstall a program
Does it actually show up in wmic product list as HardwareComponents? Is there a .msi file associated with it? Both of these things are required to be able to do what you're trying to do.
- 13 Feb 2023 21:22
- Forum: DOS Batch Forum
- Topic: DEL oldfiles
- Replies: 10
- Views: 3289
Re: DEL oldfiles
Would it be faster to move all the files that are younger than 3 days old somewhere else and then delete the folders entirely? Barring that, BestBuy is currently selling 18 TB external hard drives for $290, which is cheaper than they're usually going for. It may be worth upgrading your storage so th...
- 13 Feb 2023 19:09
- Forum: DOS Batch Forum
- Topic: DEL oldfiles
- Replies: 10
- Views: 3289
Re: DEL oldfiles
Delete fewer files?
- 13 Feb 2023 00:36
- Forum: DOS Batch Forum
- Topic: DEL oldfiles
- Replies: 10
- Views: 3289
Re: DEL oldfiles
That's what the forfiles command is for.
See https://stackoverflow.com/questions/510 ... han-n-days for more examples.
Code: Select all
forfiles /p "C:\what\ever" /s /m *.* /D -<number of days> /C "cmd /c del @path"
- 04 Jan 2023 05:28
- Forum: DOS Batch Forum
- Topic: Survey Popup - RESULTS
- Replies: 8
- Views: 77223
Re: Survey Popup - RESULTS
Because this is a specialized forum about a specific topic. I'd like to direct your attention to the very top of the website, where it reads "A Forum all about DOS Batch." Admittedly this isn't as true as it used to be since command.com was deprecated in Windows NT, but it's still batch. If you want...
- 08 Dec 2022 02:25
- Forum: DOS Batch Forum
- Topic: Can't change directory using cmd script
- Replies: 2
- Views: 6982
Re: Can't change directory using cmd script
That error you're getting means that your script is not saved with the correct encoding. Save your script as ANSI (or UTF-8 if you absolutely have to, but ANSI works best).
- 07 Dec 2022 04:52
- Forum: DOS Batch Forum
- Topic: Putting code output into a variable for string matching
- Replies: 4
- Views: 4652
Re: Putting code output into a variable for string matching
Correct; the code doesn't work if it stops being all on one line because of how the powershell is being executed. I only split it up to make it easier to read, I didn't add line continuation characters to make it keep working. If you want to store the output of the powershell command in a variable, ...
- 06 Dec 2022 17:26
- Forum: DOS Batch Forum
- Topic: Putting code output into a variable for string matching
- Replies: 4
- Views: 4652
Re: Putting code output into a variable for string matching
It's much easier to read the code when it isn't all on one line. @( Set/P "=The color is currently set to "<NUL For /F %%# In (' ^""%__AppDir__%WindowsPowerShell\v1.0\powershell.exe" -NoP "$Console=(Get-Host).UI.RawUI; Switch($Console.BackgroundColor,$Console.ForegroundColor){ 'Black'{'0'} 'DarkBlue...
- 05 Dec 2022 13:07
- Forum: DOS Batch Forum
- Topic: copy
- Replies: 12
- Views: 6764
Re: copy
%0 returns the entirety of what was typed when the script was called. Presumably they're looking for %~n0.miskox wrote: ↑05 Dec 2022 04:53%0 returns batch name.
SasoCode: Select all
@echo %0
P.S. Use code tags, please.
- 14 Nov 2022 09:13
- Forum: DOS Batch Forum
- Topic: What is the magic code ?
- Replies: 2
- Views: 2241
Re: What is the magic code ?
User Data contains a space, so you need to wrap the path in quotes.
Code: Select all
copy "C:\Users\Joe\AppData\Local\Google\Chrome\User Data\Default\bookmarks" C:\Data\Chrome
- 09 Nov 2022 20:19
- Forum: DOS Batch Forum
- Topic: Timeout via for loop
- Replies: 15
- Views: 10475
Re: Timeout via for loop
Did you only want the "BERR_OUT_OF_SYSTEM_MEMORY" bit instead of the full line?
- 06 Nov 2022 02:08
- Forum: DOS Batch Forum
- Topic: Passing arguments to a subroutine
- Replies: 4
- Views: 4141
Re: Passing arguments to a subroutine
"It does not work" doesn't really give us enough information. What error message are you getting? Right now, my best guess is that because you pass %%G with quotes surrounding it and then you reference "%3" in the subroutine, you're doubling up the quotes, which is breaking things. Either get rid of...