Search found 4506 matches

by aGerman
23 Dec 2010 09:42
Forum: DOS Batch Forum
Topic: Variable able to run various apps from same location
Replies: 10
Views: 10876

Re: Variable able to run various apps from same location

Because c:\program files\microsoft office\office14 is not part of the PATH variable you would need the full name. The START command could work without path and it's probably a better way (because it makes no sense to keep the batch window open). start "" /max "%theprogram%" And (...
by aGerman
23 Dec 2010 09:23
Forum: DOS Batch Forum
Topic: Findstr help
Replies: 8
Views: 6993

Re: Findstr help

But the ECHO command shows the right files? In this case it could be that you've got file names with spaces. Try to enclose the variable in double quotes. @echo off for /f "delims=" %%a in ('dir /a-d /b *.txt') do ( for /f "delims=" %%b in (' findstr /c:"hey" "%%a&...
by aGerman
21 Dec 2010 09:05
Forum: DOS Batch Forum
Topic: Findstr help
Replies: 8
Views: 6993

Re: Findstr help

Hmm, works for me. Please give an example for testing.

Regards
aGerman
by aGerman
20 Dec 2010 16:34
Forum: DOS Batch Forum
Topic: Findstr help
Replies: 8
Views: 6993

Re: Findstr help

The following code displays .txt files of the current directory which contain 111 AND 222 AND 333. @echo off for /f "delims=" %%a in ('dir /a-d /b *.txt') do ( for /f "delims=" %%b in (' findstr /c:"111" "%%a" ^>nul ^&^& findstr /c:"222" &quo...
by aGerman
14 Dec 2010 16:30
Forum: DOS Batch Forum
Topic: Help with shutdown abort script
Replies: 11
Views: 12311

Re: Help with shutdown abort script

[EDIT]
Wait. There is no message at all if it succeeded. This is a point we could exploit.
This line works for me and I think it should work on XP too:

Code: Select all

shutdown -a 2>&1 |findstr . >nul ||echo shutdown was aborted

[/EDIT)
by aGerman
14 Dec 2010 16:10
Forum: DOS Batch Forum
Topic: Help with shutdown abort script
Replies: 11
Views: 12311

Re: Help with shutdown abort script

Well, in this case I suppose there is no safe method to find out if it succeeded or not.

Regards
aGerman
by aGerman
14 Dec 2010 15:40
Forum: DOS Batch Forum
Topic: Help with shutdown abort script
Replies: 11
Views: 12311

Re: Help with shutdown abort script

@BrentNewland
Your positive feedback is enough donation. Glad I could help.

@ChickenSoup
Did you check if shutdown returns an errorlevel on XP?

Regards
aGerman
by aGerman
14 Dec 2010 14:06
Forum: DOS Batch Forum
Topic: Help with shutdown abort script
Replies: 11
Views: 12311

Re: Help with shutdown abort script

@ChickenSoup On my computer (Win7) this doesn't work because the message is written to stdErr. But this would process the message because it is redirected to stdOut: FOR /f "tokens=*" %%a IN ('shutdown -a 2^>^&1') DO SET shutdownstatus=%%a But also this doesn't work for me because my e...
by aGerman
14 Dec 2010 13:20
Forum: DOS Batch Forum
Topic: Help with shutdown abort script
Replies: 11
Views: 12311

Re: Help with shutdown abort script

Try this:

Code: Select all

@echo off
:start
shutdown -a 2>nul &&echo shutdown was aborted
goto start

2>nul eliminates outputting of error messages by redirecting to NUL
&& associates the following command if the previous command was successful (errorlevel 0)

Regards
aGerman
by aGerman
13 Dec 2010 11:09
Forum: DOS Batch Forum
Topic: how to copy a folder by date?
Replies: 13
Views: 10108

Re: how to copy a folder by date?

Um, sorry ... what is the meaning of your last post :?
I don't get it.

Regards
aGerman
by aGerman
12 Dec 2010 18:02
Forum: DOS Batch Forum
Topic: how to copy a folder by date?
Replies: 13
Views: 10108

Re: how to copy a folder by date?

Try: @echo off &setlocal if exist style.ini for /f "delims=" %%a in (style.ini) do set "%%a" if not defined color ( setlocal enabledelayedexpansion set /p "color=Enter a color combination: " color !color! >style.ini echo color=!color! endlocal ) else ( color %color%...
by aGerman
12 Dec 2010 12:33
Forum: DOS Batch Forum
Topic: how to copy a folder by date?
Replies: 13
Views: 10108

Re: how to copy a folder by date?

Show me the content of your INI file and your batch file (both enclosed in code tags). Otherwise I'm not able to see where it fails. As I said, the example worked for me.

Regards
aGerman
by aGerman
12 Dec 2010 08:53
Forum: DOS Batch Forum
Topic: how to copy a folder by date?
Replies: 13
Views: 10108

Re: how to copy a folder by date?

Hmm, works fine for me.
Did you change the Test.ini according my example? What is the output?

BTW: Why did you translate code or the content of files?

Regards
aGerman
by aGerman
12 Dec 2010 08:09
Forum: DOS Batch Forum
Topic: how to copy a folder by date?
Replies: 13
Views: 10108

Re: how to copy a folder by date?

Test.ini color = fc color = ab Don't use the same value for different data and be careful with white spaces (also in your batch code). Test.ini color1=fc color2=ab ReadIni.bat @echo off &setlocal for /f "delims=" %%a in (Test.ini) do set "%%a" echo %color1% echo %color2% pau...
by aGerman
12 Dec 2010 07:45
Forum: DOS Batch Forum
Topic: how to copy a folder by date?
Replies: 13
Views: 10108

Re: how to copy a folder by date?

what does "||" If pushd fails then goto :eof (quit the batch) will proceeded. or "& setlocal" You probably don't need it. It's just to protect you from wrong values if you run several batch files in the same environment (e.g. by dropping them onto a a command prompt). and &q...