Search found 1841 matches

by penpen
18 Sep 2020 05:48
Forum: DOS Batch Forum
Topic: command retunrs no value even though entry exists
Replies: 14
Views: 484

Re: command retunrs no value even though entry exists

Only flying over your source (i actually have few time, sorry). I assume that prior to the if command the environment variable GamePath is undefined; you might want to check that by adding: echo("GamePath=%GamePath%" IF /I "%DoGame:~0,1%"=="Y" ( :: ... ) Based on that Gamepath is undefined: Some of ...
by penpen
18 Sep 2020 05:17
Forum: DOS Batch Forum
Topic: How to pass "chcp 1252" command to START "" /B /WAIT program?
Replies: 4
Views: 148

Re: How to pass "chcp 1252" command to START "" /B /WAIT program?

If i remember right, then start does not support shell/batch commands, so you might have to start the command interpreter:

Code: Select all

start "" /NORMAL /B /WAIT  "cmd /c">nul chcp 1252 && D:\foobar\myprog.exe /parm1 /parm2 someparm""
penpen
by penpen
17 Sep 2020 12:35
Forum: DOS Batch Forum
Topic: command retunrs no value even though entry exists
Replies: 14
Views: 484

Re: command retunrs no value even though entry exists

The thing is, that a codeblock like the one i suspected above (and that you confirmed to use) can't work: ( Echo Checking for Runescape for /F "Usebackq Tokens=1* delims=," %%a in ("%SrcPath%\folders.txt") do IF /I "%%a"=="Runescape" set GamePath=%%b IF "%GamePath%"=="" Echo Empty path returned for ...
by penpen
14 Sep 2020 09:37
Forum: DOS Batch Forum
Topic: command retunrs no value even though entry exists
Replies: 14
Views: 484

Re: command retunrs no value even though entry exists

Yanta wrote:
14 Sep 2020 04:32
I still am..
If your old and new code both work from inside a compound statement and your old code doesn't work, but your new one does then i suspect your new code to use delayed expansion (!variable!), contrary to your old code where you used regular expansion (%variable%).
by penpen
13 Sep 2020 05:10
Forum: DOS Batch Forum
Topic: command retunrs no value even though entry exists
Replies: 14
Views: 484

Re: command retunrs no value even though entry exists

I suspect you initially used a code block (encapsulated in parentheses):

Code: Select all

(
Echo Checking for Runescape
for /F "Usebackq Tokens=1* delims=," %%a in ("%SrcPath%\folders.txt") do IF /I "%%a"=="Runescape" set GamePath=%%b
IF "%GamePath%"=="" Echo Empty path returned for Runescape
)
by penpen
06 Sep 2020 07:41
Forum: DOS Batch Forum
Topic: How to create files.ext from .txt??
Replies: 3
Views: 316

Re: How to create files.ext from .txt??

Sorry, but i don't understand, what you are asking for.
by penpen
06 Sep 2020 05:10
Forum: DOS Batch Forum
Topic: FOR doesn't iterate properly
Replies: 4
Views: 351

Re: FOR doesn't iterate properly

Typically the command line is echoingyou can avoid that by zsing a '@'-character at the right place, which should be something like the following:

Code: Select all

FOR %G IN (*.pdf) DO @(
    SET newfile=%G
    SET dpi=%newfile:~0,6%
    echo %dpi%
)

penpen
by penpen
06 Sep 2020 05:02
Forum: DOS Batch Forum
Topic: Making a program process multipe files and........can I ask for assitance
Replies: 8
Views: 421

Re: Making a program process multipe files and........can I ask for assitance

I searched google for "CsvView", "Manual" and "Documentation" and got the following as the first link: https://datfile.net/Doc/intro.html . In the "CsvView Manual" (first item there) you can find the link TXTlogToCSVtool . In the OP there, it states: Notice 3: Tool can be also run from command line ...
by penpen
31 Aug 2020 15:12
Forum: DOS Batch Forum
Topic: SerialPort copy string instead of file
Replies: 5
Views: 461

Re: SerialPort copy string instead of file

1) the "U_" always at the beginning stands for what? It has no special purpose - my first name starts with an U and that way i could list both variables at the same time using the command "set U_" (without doublequotes) Also both labels do contain data with different semantics - which probably is v...
by penpen
29 Aug 2020 08:39
Forum: DOS Batch Forum
Topic: SerialPort copy string instead of file
Replies: 5
Views: 461

Re: SerialPort copy string instead of file

I think the main issue here is the NULL-byte (stored in "0.chr"), so you can't use single byte codepages to echo that value and have to workaround that. I couldn't find a codepage that enables you to echo the whole byte sequence as a single string, but you might use a mix of ANSI and unicode charact...
by penpen
25 Aug 2020 10:17
Forum: DOS Batch Forum
Topic: Batch file opens another batch file - pushing commands into the second file
Replies: 1
Views: 376

Re: Batch file opens another batch file - pushing commands into the second file

The answer heavily relies on what you might mean with the term "open", some possibilities: - you called your second batch file, so it actually runs and you want it to change itself while running, - you have used a for/f-loop using the findstr on your second batch file which length is <= 8192 bytes l...
by penpen
25 Aug 2020 10:09
Forum: DOS Batch Forum
Topic: Output several lines of C# code to .cs file
Replies: 1
Views: 346

Re: Output several lines of C# code to .cs file

There are two reasons why your function ":WriteTemplate" doesn't work: 1) You are using a compound statement (aka block), therefore you must escape closing parentheses ("^)") in order to prevent the command line interpreter from thinking that the block ends there. Note that you also have to escape a...
by penpen
17 Aug 2020 05:12
Forum: DOS Batch Forum
Topic: open file at a specific time
Replies: 3
Views: 453

Re: open file at a specific time

You could extract time information using for- and wmic-command and then check if you are not within 2 and 5 am @echo off setlocal enableExtensions enableDelayedExpansion set "stamp=" for /f "skip=1 delims=.," %%a in ('wmic os get localDateTime') do if not defined stamp set "stamp=%%~a" set /a "stamp...
by penpen
12 Aug 2020 11:40
Forum: DOS Batch Forum
Topic: Letter used in a variable.
Replies: 15
Views: 1258

Re: Letter used in a variable.

So using your code I would end up with . . . No, the for loop was meant as an example for what could go wrong. So you also should guard against empty input and aborted input (pressing "CTRL+C" during set/p execution; which you correctly mapped to empty input by initializing the environment variable...
by penpen
12 Aug 2020 02:46
Forum: DOS Batch Forum
Topic: Letter used in a variable.
Replies: 15
Views: 1258

Re: Letter used in a variable.

Sidenote: When using set/p (or when asking for input you don't conrol in general) you should always guard against invalid input. For example your first codeblock here may enable others to execute any code he/she/... wants by typing input like the following: nul ( a ) else echo Selected Option D. & g...