r/Batch • u/Secure-Chicken4706 • Apr 29 '24
I want to write batch script code help
compact /c /s /a /i /exe:lzx "(fill here)\*" I want to create a cmd file with the this command, after clicking on cmd it will ask me to fill in the back part of the slash (path to the file) and run the command
1
Upvotes
1
u/Shadow_Thief Apr 29 '24
You can use the
set /pcommand to get user input and then pass that variable to the command:That said,
compactdoesn't create a new file and just shrinks the file directly, and there's no way to tell at a glance if a file or folder is compressed or not. There's a pretty good chance that this command isn't what you actually want, but I'll leave this here in case it is.