Search found 3184 matches

by aGerman
17 Jul 2018 15:20
Forum: DOS Batch Forum
Topic: How to Create a File List with some modification using Simple Batch File
Replies: 9
Views: 76

Re: How to Create a File List with some modification using Simple Batch File

DO NOT OVERWRITE the predefined PATH variable!
You don't even need an additional variable because you already have %cd%.

Code: Select all

for /f "tokens=5* delims=\" %%a in ("%cd%") do set "base=%%b"
Steffen
by aGerman
17 Jul 2018 14:06
Forum: DOS Batch Forum
Topic: How to Create a File List with some modification using Simple Batch File
Replies: 9
Views: 76

Re: How to Create a File List with some modification using Simple Batch File

The passed folder is in %~1. The %cd% variable is set automatically and contains the current working directory.

Steffen
by aGerman
17 Jul 2018 13:30
Forum: DOS Batch Forum
Topic: How to Create a File List with some modification using Simple Batch File
Replies: 9
Views: 76

Re: How to Create a File List with some modification using Simple Batch File

From the above code, how can I add a dynamic directory level in the below set command set dir=DIRECTORY: \"%nptn%" --> set dir=DIRECTORY: \"%nptn%\subfolder" (this one for the subfolder level contents.lst) Sorry but you lost me. After the PUSHD command the current working directory is changed to th...
by aGerman
17 Jul 2018 10:29
Forum: DOS Batch Forum
Topic: How to Create a File List with some modification using Simple Batch File
Replies: 9
Views: 76

Re: How to Create a File List with some modification using Simple Batch File

What is that funny bottom_contents.txt for? Recursion should work. @echo off &setlocal call :listdir "C:\auto_pkg_build\Workspace\Build_pkg\T592-08878-0101_Link2500_TCPX_NARInfra_GEN_PROD\T592-08878-0101" goto :eof :listdir pushd "%~1" 2>nul del "bottom_contents.txt" >"Contents.lst" type nul for /f ...
by aGerman
17 Jul 2018 07:40
Forum: DOS Batch Forum
Topic: Not So Simple Change Window Title
Replies: 3
Views: 75

Re: Not So Simple Change Window Title

Looks like I'll be creating that SetText.exe program or using AutoHotKey. Of course you can basically use any language that supports the Windows API functions. But that was actually not my point. It's still the question how a program or script shall find the right window. See my list above. Then pi...
by aGerman
16 Jul 2018 17:23
Forum: DOS Batch Forum
Topic: Definition and use of arithmetic "functions" in Batch files
Replies: 26
Views: 4352

Re: Definition and use of arithmetic "functions" in Batch files

This is syntactic sugar :lol: Thanks for sharing.

Steffen
by aGerman
16 Jul 2018 12:45
Forum: DOS Batch Forum
Topic: URGENT! Problem with script from testing machine to production
Replies: 5
Views: 70

Re: URGENT! Problem with script from testing machine to production

Several issues could cause your error. First of all NEVER overwrite the already predefined path variable. Command line utilities will not be found anymore. Use another variable name. Delayed expansion may cause failures if the passed parameters contain exclamation points. Special characters like spa...
by aGerman
16 Jul 2018 10:10
Forum: DOS Batch Forum
Topic: Not So Simple Change Window Title
Replies: 3
Views: 75

Re: Not So Simple Change Window Title

I want to change the title of cmd.exe windows, not all windows. Are there specific command lines that will do the job, or must I create this SetText.exe program? There is no command to change the title of a foreign window. Maybe it can be done using an emedded Powershell call. But that depends on h...
by aGerman
12 Jul 2018 02:23
Forum: DOS Batch Forum
Topic: Create, modify, or display an environment variable in another process
Replies: 1
Views: 107

Re: Create, modify, or display an environment variable in another process

Changing a foreign process environment is actually not intended. Not even changes in the parent process environment. Child processes inherit the environment from their parent processes, not vice versa. Hacks like DLL injection are needed for that. The only tool I'm aware of is editv . But it allows ...
by aGerman
11 Jul 2018 12:35
Forum: DOS Batch Forum
Topic: Cmdwiz - cmd helper tools (now with Unicode)
Replies: 26
Views: 4164

Re: Cmdwiz - cmd helper tools

Yes, Steffen only had to wait almost 2 years for his feature request to be implemented :P Sorry about that. Don't worry about that. I was quite sure you would implemt this feature sooner or later :lol: I might be wrong about this, but a more general problem seems to be that for Unicode command line...
by aGerman
28 Jun 2018 07:21
Forum: DOS Batch Forum
Topic: Double expansion ? Trouble expanding a variable inside another variable and displaying it
Replies: 5
Views: 233

Re: Double expansion ? Trouble expanding a variable inside another variable and displaying it

Um things like that are a little weird. As I understand your question you want the user to enter a variable name. Why? @echo off &setlocal set var=4 set /p "a=Enter a variable name: " echo Entered: %a% :: assign the value of var to the entered name set "%a%=%var%" :: either use call ... call echo %a...
by aGerman
27 Jun 2018 01:39
Forum: DOS Batch Forum
Topic: How to check (with "tasklist" built-in cmd) if prgm is running?
Replies: 1
Views: 188

Re: How to check (with "tasklist" built-in cmd) if prgm is running?

TASKLIST does neither set the errorlevel nor does it write to StdErr. Usually I pass the output to FINDSTR which changes the errorlevel accordingly. set "proc=myprog.exe" tasklist /nh /fi "imagename eq %proc%" | >nul findstr /bic:"%proc% " echo %errorlevel% Steffen EDIT: If the process name exceeds ...
by aGerman
25 Jun 2018 09:37
Forum: DOS Batch Forum
Topic: execution of batch
Replies: 1
Views: 164

Re: execution of batch

Not sure where the error message is coming from. You might set ECHO ON in you batch code in order to see if another command is causing the error. Also note that the current working directory of the environment you execute the batch code is set to your user profile if you call it from the Run dialog....
by aGerman
25 Jun 2018 09:26
Forum: DOS Batch Forum
Topic: Extracting subdirectories and files from parent directory, using these to create dirs /copy files.
Replies: 3
Views: 186

Re: Extracting subdirectories and files from parent directory, using these to create dirs /copy files.

If you want to read the documentation then I suggest to read it for SET in order to understand how the string replacement works and for FOR in order to learn more about modifiers beginning with a ~ sign. ROBOCOPY just creates folders and files that were not found in the target path. If you still hav...