Search found 91 matches

by carlsomo
14 Apr 2013 02:48
Forum: DOS Batch Forum
Topic: Assign a string with poison characters with some limitations
Replies: 10
Views: 7429

Re: Assign a string with poison characters with some limitat

Here is the original thread I used for inspiration: http://www.dostips.com/forum/viewtopic.php?f=3&t=2836 After you run the script from the command line type this: <nul set/p="%envar%" to see what 'envar' contains. I get: '>' as a result when I do your example on my win7 machine.
by carlsomo
14 Apr 2013 02:29
Forum: DOS Batch Forum
Topic: Assign a string with poison characters with some limitations
Replies: 10
Views: 7429

Re: Assign a string with poison characters with some limitat

The Rem statement writes to getargs.txt and then the batch reads from the file created to assign the variable 'args'. This has been posted previously as a method to deal with poison strings. I stand on the shoulders of giants who could explain it better, I am sure. I suggest you copy and paste the b...
by carlsomo
14 Apr 2013 01:57
Forum: DOS Batch Forum
Topic: Assign a string with poison characters with some limitations
Replies: 10
Views: 7429

Assign a string with poison characters with some limitations

I have used what I have learned from this site to create a batch file to assign a string containg poison characters to a variable with the following batch file. It has its limitations that are described in the help section. If anyone can improve on this I would be grateful. Here is my attempt at Ass...
by carlsomo
29 Mar 2013 22:02
Forum: DOS Batch Forum
Topic: Another way to create a line feed variable
Replies: 8
Views: 11238

Re: I there a way for save the result of Prompt $_

I used this in a script to write 'set LF=^' to a line in a file without a trailing space: for /f "tokens=2* delims=÷" %%a in ('"for %%b in (1) do rem ÷set LF=^÷"') do echo(%%a>>"%temp%\file.ext I'm not sure if that is what you are looking for but it worked for my purposes. C...
by carlsomo
19 Feb 2013 23:59
Forum: DOS Batch Forum
Topic: [solved]One batch file, two computers, two different results
Replies: 12
Views: 7814

Re: [solved]One batch file, two computers, two different res

This routine works in pure batch with all english date settings and non pure batch in foreign ones: @echo off&SetLocal EnableDelayedExpansion&goto :start or :English is faster on US machine :GetDate [EnVar] [/s] echo.GetDate [EnVar] Sets date into environment variable, EnVar as: mm-dd-yyyy e...
by carlsomo
10 Feb 2013 18:29
Forum: DOS Batch Forum
Topic: Help Process and assign special characters from cmd line
Replies: 4
Views: 4226

Re: Help Process and assign special characters from cmd line

Thanks Dave,
It is certainly an advantage to not have to worry about placing escape chars. I just wish there was a way to get the all command line args with poison chars but without using a temp file.
by carlsomo
10 Feb 2013 16:03
Forum: DOS Batch Forum
Topic: Help Process and assign special characters from cmd line
Replies: 4
Views: 4226

Help Process and assign special characters from cmd line

I have a batch that I wish to assign the entire command line to a string ie. set "string=%*" However input from the command line may have speical characters such as: ^ & < > |, etc for instance: test.bat (This is a ~!@#)$^^^^%*^&_-^|=+ string) to get this result in a variable: stri...
by carlsomo
26 Jan 2013 00:34
Forum: DOS Batch Forum
Topic: How to question: process display until user presses a key
Replies: 2
Views: 2529

Re: How to question: process display until user presses a ke

That is exactly what I did and by the way I use your getkey.exe program all the time and I cannot thank you enough for that. I write numerous user interaction DOS snippets and it comes in very handy where set/p and choice just do not offer the same control over what uncontrollable users can do to me...
by carlsomo
25 Jan 2013 23:35
Forum: DOS Batch Forum
Topic: How to question: process display until user presses a key
Replies: 2
Views: 2529

How to question: process display until user presses a key

Let's say you wish to run a process until the user presses any key While waiting for the event you wish a process to keep running, ie. dispalay a running timer call :SetCR CR set timestart=%time% :loop call :calculatetime %timestart% timefromzero <nul set/p=%timefromzero%!CR! call :keypressedOrNot? ...
by carlsomo
15 Jan 2013 23:20
Forum: DOS Batch Forum
Topic: How to jump to the root directory from current directory
Replies: 11
Views: 10829

Re: How to jump to the root directory from current directory

Code: Select all

set fullpath=c:\windows\system32
d:
echo %cd%
echo %fullpath%
cd /d %fullpath%\.\..
echo %__CD__% is the parent dir of fullpath with a trailing '\'
echo %cd% is the parent dir of fullpath without the trailing '\'
by carlsomo
19 Nov 2012 21:10
Forum: DOS Batch Forum
Topic: Command line parameter parsing issue
Replies: 11
Views: 7029

Re: Command line parameter parsing issue

jeb the delayed expansion with quoted strings is a great solution, thanks. As I recall I had a batch routine that used set/p="%$Bs%..." with the $Bs set to non destructive backspace and it worked fine in Win 7 but not in XP. When I removed the quotes it worked in XP. I think I also had som...
by carlsomo
19 Nov 2012 03:52
Forum: DOS Batch Forum
Topic: Command line parameter parsing issue
Replies: 11
Views: 7029

Re: Command line parameter parsing issue

@echo off set "msg=%~1" echo(Version2 if %1 equ %msg% (echo %1... is not quoted) else (echo %1... is quoted) pause echo(Version1 if %msg% equ %1 (echo %1... is not quoted) else (echo %1... is quoted) pause There you go. Neither of them worked, and version two did fail differently. d:\ABC>...
by carlsomo
19 Nov 2012 02:18
Forum: DOS Batch Forum
Topic: Command line parameter parsing issue
Replies: 11
Views: 7029

Re: Command line parameter parsing issue

C:\testbatch>message.bat "Enter a string" 1 Version1 a was unexpected at this time. C:\testbatch>message.bat "enter a string" 2 Version2 "enter a string"... is quoted Would you please try running it on your own machine befor making assumptions in your reply?? thanks carl
by carlsomo
19 Nov 2012 01:00
Forum: DOS Batch Forum
Topic: Safely expand any variable.
Replies: 5
Views: 6103

Re: Safely expand any variable.

my apologies
by carlsomo
19 Nov 2012 00:31
Forum: DOS Batch Forum
Topic: Command line parameter parsing issue
Replies: 11
Views: 7029

Re: Command line parameter parsing issue

There does not seem to be an issue with poison characters in fact I have not even experimented with them on this simple routine. I have a batch that accepts user input and arg1 one and two are a "string" and variable submitted in either order. I went nuts trying to determine which was whic...