Last active
July 12, 2023 03:44
-
-
Save toydotgame/2710c3089483931d79a6b0e4ab67b553 to your computer and use it in GitHub Desktop.
Batch script to pseudo-emulate Command Prompt without actually requiring group policy.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ECHO OFF | |
REM CREATED ON: 2023-07-11 | |
REM AUTHOR: toydotgame | |
REM cmdscript!!!?!?! | |
DOSKEY ls=dir | |
DOSKEY clear=cls | |
REM SETLOCAL enabledelayedexpansion | |
REM Set working dir at `~`: | |
CD /D %homedrive%%homepath% | |
TITLE %windir%\system32\cmd.exe | |
REM Concat `VER` output to only the line with version info: | |
VER | findstr Windows | |
ECHO (c) Microsoft Corporation. All rights reserved. | |
:CmdLoop | |
ECHO: | |
SET /p cmd="%cd%> " | |
IF "%cmd%" EQU "!!" ( | |
CALL %pcmd% | |
GOTO :CmdLoop | |
) | |
SET pcmd=%cmd% | |
REM The following creates an issue where non-defined variables are not printed explicitly: | |
REM `echo %asdf%` prints "ECHO is off." to stdout in this case. | |
REM Expected: `echo %asdf%` prints "\r\n" to stdout. | |
ECHO %cmd%>%tmp%\cmd.bat | |
CALL %tmp%\cmd.bat | |
DEL %tmp%\cmd.bat | |
GOTO :CmdLoop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment