Search found 132 matches

by Docfxit
30 May 2024 09:55
Forum: DOS Batch Forum
Topic: Do not expand Comments
Replies: 5
Views: 13682

Re: Do not expand Comments

shodan: That is really great. That is exactly what I wanted.
That's super.

Thank you very much...
by Docfxit
29 May 2024 20:36
Forum: DOS Batch Forum
Topic: Do not expand Comments
Replies: 5
Views: 13682

Do not expand Comments

I would like to show a comment that is not expanded and the expanded version of the command. I have a batch file with commands: @Echo Off Echo ^%^%~dp0^%^% = %~dp0 Echo %cd% Echo %~d0 Echo %~p0 Echo %~fn0 Echo %~dpn0.txt Echo %~nx0 Echo %~fs0 @cmd /k I tried with the first line but it doesn't show t...
by Docfxit
06 Mar 2024 23:55
Forum: DOS Batch Forum
Topic: How to debug this bat file
Replies: 6
Views: 16394

Re: How to debug this bat file

So, did you try it? Does it work? Start here: https://ss64.com/nt/syntax-esc.html Escape Character ^ Escape character. Adding the escape character before a command symbol allows it to be treated as ordinary text. These characters which normally have a special meaning can be escaped and then treated...
by Docfxit
05 Mar 2024 17:40
Forum: DOS Batch Forum
Topic: How to debug this bat file
Replies: 6
Views: 16394

Re: How to debug this bat file

The reason I create a thread here is so I can learn something. I don't come here to place bets. I did a search on all the bat files I have. I did find some bat files with a carrot. The only reason I have bat files with a carrot is because I have copied it from someone else's code. I have never used ...
by Docfxit
05 Mar 2024 12:20
Forum: DOS Batch Forum
Topic: How to debug this bat file
Replies: 6
Views: 16394

Re: How to debug this bat file

Thank you for the reply...

If I add ^ infront of the problematic characters (, ), |

What would the line look like?
I'm not familiar with that character.

Isn't that line a remark? Why would the cmd interpreter care what characters are in a remark?

Thank you,
by Docfxit
04 Mar 2024 14:22
Forum: DOS Batch Forum
Topic: How to debug this bat file
Replies: 6
Views: 16394

How to debug this bat file

I have a bat file that I can't find why it has a syntax error. This is the console output in Windows 10. I can't find what is causing the last line. C:\Dnload\9xAddons\VNC_Install>chcp 65001 1>nul C:\Dnload\9xAddons\VNC_Install>Rem The following code will make sure this is running as Administrator C...
by Docfxit
03 Dec 2023 11:55
Forum: DOS Batch Forum
Topic: Copy cmd window and write to .txt
Replies: 2
Views: 22257

Copy cmd window and write to .txt

I would like to find out how to copy the CMD window after a cmd is run and write the output to a .txt file. I would like to have a .bat file run the cmd: bootrec /rebuildbcd And copy the output in the cmd window: bootrec /rebuildbcd Scanning all disks for Windows installations. Please wait, since th...
by Docfxit
30 Nov 2023 17:35
Forum: DOS Batch Forum
Topic: dism.exe isn't running.
Replies: 6
Views: 29504

Re: dism.exe isn't running.

Thank you both for the reply...

That solved that problem.

I have run into another problem that I can't figure out.

Code: Select all

C:\>C:\Batch\SetACL.exe -on "C:\Temp" -ot folder -actn ace "n:Win10BootRepair\Gary;p:full"
ERROR in command line: Invalid object type specified: folder!
by Docfxit
30 Nov 2023 01:21
Forum: DOS Batch Forum
Topic: dism.exe isn't running.
Replies: 6
Views: 29504

dism.exe isn't running.

This code isn't working: C:\>If "10.0" == 10.0 ( Echo Running Window 10 If "C:" == C: (dism.exe /Online /Cleanup-Image /RestoreHealth /ScratchDir:C:\Temp 1>>"G:\Dnload\SFCResults.txt" ) IF NOT "C:" == C: (dism.exe /image:C:\ /cleanup-image /RestoreHealth /ScratchDir:C:\Temp 1>>"G:\Dnload\SFCResults....
by Docfxit
22 Nov 2023 10:33
Forum: DOS Batch Forum
Topic: Change to upper case and add a :
Replies: 4
Views: 23154

Re: Change to upper case and add a :

That's really great.

Thank you very much,

Happy Thanksgiving...
by Docfxit
22 Nov 2023 00:54
Forum: DOS Batch Forum
Topic: Change to upper case and add a :
Replies: 4
Views: 23154

Change to upper case and add a :

I would like to make sure the input letter is upper case and I would like to add a : the code below doesn't add the colin. setlocal EnableDelayedExpansion set /p Drive=Please enter drive letter. Example C call :Uppercase Drive set "colin = :" set "Drive &= %colin%" Echo %Drive% pause goto:eof :Upper...
by Docfxit
13 Oct 2023 09:48
Forum: DOS Batch Forum
Topic: Variable inside an IF not showing correctly
Replies: 18
Views: 115598

Re: Variable inside an IF not showing correctly

If I understand correctly, Is this correct? if %_OS%==64 ( Set FileName=SecureVNCPlugin64.dsm if not exist "%FileName%" ( set "file=!file!!lf! ? %FileName%" robocopy "%IPADDRESS%\Dnload\VNC" "!wkdir!" "%FileName%" set errlev=!errorlevel!&REM IF !errlev! LSS 8 GOTO FileCopied) ) Set FileName=VNCultra...
by Docfxit
12 Oct 2023 17:22
Forum: DOS Batch Forum
Topic: Variable inside an IF not showing correctly
Replies: 18
Views: 115598

Re: Variable inside an IF not showing correctly

Thanks for the reply... I saw: Error Meaning if set 0 No errors occurred, and no copying was done. The source and destination directory trees are completely synchronized. I'm getting ERRORLEVEL = 0 which says "no copying was done" Yet it does copy the file. My code is: "IF NOT ERRORLEVEL 1 GOTO File...
by Docfxit
12 Oct 2023 15:47
Forum: DOS Batch Forum
Topic: Variable inside an IF not showing correctly
Replies: 18
Views: 115598

Re: Variable inside an IF not showing correctly

When I use this code with xcopy the Errorlevel is "0": :FileCopied Echo ~*~*~*~*~*~*~*~*~*~*~*~ I passed by FileCopied ~*~*~*~*~*~*~*~*~*~*~*~ set "file=" if not exist "%FileName%" ( set "file=!file!!lf! ? %FileName%" xcopy /y /f "Z:\%FileName%" "%wkdir%" Echo %ERRORLEVEL% IF NOT ERRORLEVEL 1 GOTO F...
by Docfxit
10 Oct 2023 22:50
Forum: DOS Batch Forum
Topic: Variable inside an IF not showing correctly
Replies: 18
Views: 115598

Re: Variable inside an IF not showing correctly

set wkdir=%cd% Echo "wRkdir = -" !wRkdir! wkdir and wRkdir variables. Saso I really don't understand why a batch file won't run correctly when I don't spell variables correctly. The DOS scripting language is very old. In this day and age it would be nice if it would tell me I made a blundering erro...