Search found 3737 matches

by aGerman
24 Jun 2010 15:59
Forum: DOS Batch Forum
Topic: Copy to individual profiles
Replies: 4
Views: 2276

Re: Copy to individual profiles

@echo off &setlocal pushd "%userprofile%\.." for /f "delims=" %%a in ('dir /ad /b') do ( set "userDesktop=%%~dpnxa\Desktop" call :proc ) popd pause goto :eof :: ~~~~~~~~~~~~~~~~~~~ :proc echo %userDesktop% goto :eof Do your copy stuff in subroutine :proc. Regards a...
by aGerman
24 Jun 2010 13:09
Forum: DOS Batch Forum
Topic: Copy to individual profiles
Replies: 4
Views: 2276

Re: Copy to individual profiles

Have you access to work into a different users profile?

What about "%ALLUSERSPROFILE%\Desktop" to show it on each users desktop?

Regards
aGerman
by aGerman
24 Jun 2010 13:02
Forum: DOS Batch Forum
Topic: Sensing what key is pressed on the keyboard
Replies: 2
Views: 1919

Re: Sensing what key is pressed on the keyboard

This isn't possible using native batch.
Have look to the "getch" tool on this web site.

Regards
aGerman
by aGerman
24 Jun 2010 12:56
Forum: DOS Batch Forum
Topic: environment variable is blank
Replies: 9
Views: 3782

Re: environment variable is blank

Stange. -press keys [Windows]+[R] -type CMD -click OK to open the command prompt -type SET -hit [Enter] to display all global variables and their values Can you find GLOBENV_CAT_OUTDIR_ARCHIVE_GV in this list? Btw: Is there a command line in your batch file similar to this?: set GLOBENV_CAT_OUTDIR_A...
by aGerman
23 Jun 2010 15:08
Forum: DOS Batch Forum
Topic: environment variable is blank
Replies: 9
Views: 3782

Re: environment variable is blank

agrawal.meet If you start a batch file, it gets the current environment as a "mirror image". This "mirror image" is valid as long as your batch process runs. You can change it "inside" the process, but never from "outside". That means, regardless what you woul...
by aGerman
22 Jun 2010 13:41
Forum: DOS Batch Forum
Topic: "No valid files found" return screen from batch script (???)
Replies: 14
Views: 6954

Re: "No valid files found" return screen from batch script (

The command line distinguishes two types of output streams: StdOut (1) for regular output StdErr (2) for error output >nul redirects the StdOut to NUL. But error messages would be shown on the screen. You need 2>nul to redirect error messages to NUL. You could use the combination >nul 2>&1 to re...
by aGerman
20 Jun 2010 07:22
Forum: DOS Batch Forum
Topic: Check if command's output contains some text
Replies: 3
Views: 16487

Re: Check if command's output contains some text

You should tell us which command it is and if you try to process a Standard-Msg. or an Error-Msg.

Regards
aGerman
by aGerman
19 Jun 2010 16:13
Forum: DOS Batch Forum
Topic: Purge Disk When Full Dos Batch Files Windows XP pro
Replies: 1
Views: 1464

Re: Purge Disk When Full Dos Batch Files Windows XP pro

Hmm, it's not that easy because you can only get the free space in bytes. On big drives this value can be too high to calculate it or to compare it as number using batch. OK, first two snippets: for /f "tokens=3" %%i in ('dir /-c E:\') do set "free=%%i" echo %free% This should re...
by aGerman
18 Jun 2010 15:37
Forum: DOS Batch Forum
Topic: "No valid files found" return screen from batch script (???)
Replies: 14
Views: 6954

Re: "No valid files found" return screen from batch script (

Yes, afaik it's a limit of (less than) 2^10 characters. So indeed shift could solve it. Try something like that: @echo off &setlocal :loop if "%~1"=="" goto end echo %1 bcrypt.exe %1<"C:\windr" shift goto loop :end pause Regards aGerman [Edit: %%a replaced by %1 /]
by aGerman
17 Jun 2010 16:24
Forum: DOS Batch Forum
Topic: help correcting this code
Replies: 8
Views: 2932

Re: help correcting this code

Try this @echo off :begin cls echo ^>^>^>^> Test Nisse's phone records ^<^<^<^< echo. echo ^<1^> Search for phone numbers echo ^<2^> Enter a new phone number echo ^<3^> Remove phone number echo ^<4^> Print records on screen echo. echo ^<x^> Exit set /p "val=What's your choice (1-4): " if &...
by aGerman
17 Jun 2010 15:38
Forum: DOS Batch Forum
Topic: "No valid files found" return screen from batch script (???)
Replies: 14
Views: 6954

Re: "No valid files found" return screen from batch script (

OK. We should try a different way. If you select more than one file, then the 2nd file is in %2, the 3d in %3 etc. But all parameters you will find in %*. So save this as "encrypt.bat" to the "Send To" folder: @echo off &setlocal cd /d "%~dp1" REM just to show where...
by aGerman
17 Jun 2010 13:27
Forum: DOS Batch Forum
Topic: Filter out a line that is too long from a txt file...
Replies: 8
Views: 3726

Re: Filter out a line that is too long from a txt file...

To count the number of characters is not a good way. But if needed you could use that: @echo off >"new.txt" type nul for /f "usebackq delims=" %%a in ("old.txt") do ( for /f "skip=1 delims=:" %%b in ('^(echo.%%a^&echo.^)^|findstr /o $') do ( if %%b leq 27 ...
by aGerman
17 Jun 2010 13:16
Forum: DOS Batch Forum
Topic: "No valid files found" return screen from batch script (???)
Replies: 14
Views: 6954

Re: "No valid files found" return screen from batch script (

Hmm. Say you have a folder C:\data\somewhere If you rightclick the folder " somewhere " and "send to" your Batchfile, then you would find C:\data\somewhere in %1 or C:\data\ in %~dp1 If you would rightclick " file.ext " in C:\data\somewhere and"send to" your B...
by aGerman
16 Jun 2010 16:12
Forum: DOS Batch Forum
Topic: "No valid files found" return screen from batch script (???)
Replies: 14
Views: 6954

Re: "No valid files found" return screen from batch script (

If you right clicked a folder you will have the parent folder name in %~dp1. In this case you have to work with %1.

Regards
aGerman
by aGerman
16 Jun 2010 06:36
Forum: DOS Batch Forum
Topic: Unable to parse variable length string separated by delimite
Replies: 4
Views: 2405

Re: Unable to parse variable length string separated by deli

All 4 lines of the FOR loop are parsed as one command line by cmd.exe. That means into the same command line a regular variable doesn't change. There are 3 possibilities to handle it: -1st Use the call trick (with %% instead of %). That's what I used for the example above. -2nd Use SETLOCAL ENABLEDE...