Search found 357 matches

by alan_b
03 Jul 2010 05:28
Forum: DOS Batch Forum
Topic: How to find cause of error from "CD /D %yourPath%"
Replies: 10
Views: 9679

Re: How to find cause of error from "CD /D %yourPath%"

Thanks for that script.

Regards
Alan
by alan_b
02 Jul 2010 15:28
Forum: DOS Batch Forum
Topic: How to find cause of error from "CD /D %yourPath%"
Replies: 10
Views: 9679

Re: How to find cause of error from "CD /D %yourPath%"

Wouldn't a simple "if exist" work? rd "whatever folder" >nul 2>nul if errorlevel 1 ( if exist "whatever folder" ( echo rd failed and the folder exists -- FROZEN ) else ( echo rd failed and folder doesn't exist -- ABSENT ) ) Before I was given the secret of using "...
by alan_b
02 Jul 2010 15:05
Forum: DOS Batch Forum
Topic: How to find cause of error from "CD /D %yourPath%"
Replies: 10
Views: 9679

Re: How to find cause of error from "CD /D %yourPath%"

In HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage you will find OEMCP for the default ASCII codepage (the cmd works with) and ACP for the default ANSI codepage (used for data into the registry). You should always change the codepage to ANSI before reading data in the registry and ...
by alan_b
02 Jul 2010 02:14
Forum: DOS Batch Forum
Topic: How to find cause of error from "CD /D %yourPath%"
Replies: 10
Views: 9679

Re: How to find cause of error from "CD /D %yourPath%"

Many thanks

I will finish and release my script in English - more testing needed,
Then I will try to incorporate your registry information in version 2.

Regards
Alan
by alan_b
01 Jul 2010 15:50
Forum: DOS Batch Forum
Topic: Using variables with spaces crashes batches
Replies: 2
Views: 3537

Re: Using variables with spaces crashes batches

I suggest you try this :- set /p command="Enter a command: " ECHO %COMMAND% %command% Launch CMD.EXE, run the script and enter whatever you chosen command is, the right click the display and choose "Select All", then hit ENTER to copy the screen to the paste buffer. Then reply he...
by alan_b
01 Jul 2010 15:44
Forum: DOS Batch Forum
Topic: How to find cause of error from "CD /D %yourPath%"
Replies: 10
Views: 9679

Re: How to find cause of error from "CD /D %yourPath%"

Thanks for feedback and information. I am working on an application that is installed/removed locally by the user. I do not envisage any central rollout/deployment. I released a "Beta" version of my script a few months ago, and a German (not you) reported a problem due to my searching for ...
by alan_b
01 Jul 2010 11:31
Forum: DOS Batch Forum
Topic: How to find cause of error from "CD /D %yourPath%"
Replies: 10
Views: 9679

How to find cause of error from "CD /D %yourPath%"

I have used, but found an unfortunate side effect (that it may permanently add folders), with MD %yourPath%" & RD %yourPath%" I would greatly appreciate a similarly simple test without any side effect. My un-installation script has a long list of folder structures, and for each a set o...
by alan_b
01 Jul 2010 09:12
Forum: DOS Batch Forum
Topic: Pros and Cons of starting a script "setlocal"
Replies: 5
Views: 6447

Re: Pros and Cons of starting a script "setlocal"

Thank you for the explanation. You have now convinced me to adopt your style unless I need to see the "SET" variables as a result of running a script. I like your phrase "Unintended effects are the result", but my absolute all-time favourite has to be "The results are undefi...
by alan_b
30 Jun 2010 15:12
Forum: DOS Batch Forum
Topic: Pros and Cons of starting a script "setlocal"
Replies: 5
Views: 6447

Pros and Cons of starting a script "setlocal"

I notice many solutions here commence with the line @echo off &setlocal In the past I have only ever used setlocal for the benefit of delayed expansion, and normally I try to avoid delayed expansion where possible and never consider a setlocal. I can see an advantage that any new environment var...
by alan_b
30 Jun 2010 14:20
Forum: DOS Batch Forum
Topic: Can I double delay "delayed expansion" ?
Replies: 4
Views: 5011

Re: Can I double delay "delayed expansion" ?

Thank you so much for the solution to my problem.
That part of my script is now working fine.

Also thank you for the explanation of how the %%%% are progressively stripped down.

Alan
by alan_b
27 Jun 2010 14:29
Forum: DOS Batch Forum
Topic: Can I double delay "delayed expansion" ?
Replies: 4
Views: 5011

Re: Can I double delay "delayed expansion" ?

Thank you so much - you nailed it ! ! My only language skill is, in French, to :- Open the door (but I cannot now remember which gender) and to throw a chair out the Window. I never got a GCE 'O' level for that - but I think standards have dropped since then ! You on the other hand have a far better...
by alan_b
27 Jun 2010 11:54
Forum: DOS Batch Forum
Topic: Can I double delay "delayed expansion" ?
Replies: 4
Views: 5011

Can I double delay "delayed expansion" ?

I need to do something like CALL :SET_CD "%ALLUSERSPROFILE%\The rest of the path" with the SPECIAL feature that the code held in :SET_CD must :- expand the environmental variable and change the current directory accordingly ; set a flag to denote success or failure, and upon failure set CD...
by alan_b
17 Jun 2010 13:27
Forum: DOS Batch Forum
Topic: /WAIT parameter not working?
Replies: 4
Views: 6264

Re: /WAIT parameter not working?

I tried testing this code on Notepad.exe in place of OpenContacts.exe and the /WAIT ... Perhaps you are comparing Apples with Oranges ! If you issue the command "START /?" you get lots of obscure information. "START /WAIT ...." is very much a "maybe does" / "may d...
by alan_b
26 May 2010 05:31
Forum: DOS Batch Forum
Topic: FOR command assistance: Setting variable from command output
Replies: 7
Views: 8684

Re: FOR command assistance: Setting variable from command ou

....................... REM ver | find "XP" > nul REM if %ERRORLEVEL% == 0 ( REM ##find the line beginning with "User-friendly Name:" and set the value behind the colon to %%B FOR /F "tokens=5* delims= " %%A IN ('netsh int ip show interface ^| findstr /B /I /c:"Us...
by alan_b
26 May 2010 04:54
Forum: DOS Batch Forum
Topic: Batch file to delete files over 10 days old
Replies: 4
Views: 5883

Re: Batch file to delete files over 10 days old

I know nothing of FORFILES etc. but my attention is focussed on this snippet "-pC:\Documents and Settings\admin\Desktop\New Folder" To avoid problems with embedded spaces the file path/name need encapsulating with quotes. Just possibly this might work if the -p argument is confusing the qu...