![]() |
|
[Shell] Help Regarding External Console(s) - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [Shell] Help Regarding External Console(s) (/showthread.php?tid=4967616) Pages: Pages
1
2
|
Help Regarding External Console(s) - 'Palladium - Aug 29, 2015 Hi fellow Batch scripters, I need some help regarding a script I'm currently coding. I want the user to enter any command in an user input field and then the script will perform that command as an system/object/internal/normal command. Also, if the command is incorrect, I want the script to not show the "The command is not recognized, blah, blah" message. For example: Code @ECHO OFFI just need to figure out what "DO %userConsole" is in Batch. Also, if you could, please implement it in this script: http://pastebin.com/karsBCnw . And sorry for lack of activity everyone, I've been quite busy but I might come back to Batch coding someday in the next one month or so, anyway, thanks and good bye. * - White Light - Aug 29, 2015 It's literally just %userConsole% That's it. No "do". You don't "DO TITLE". You don't "DO @ECHO OFF". * - Ventriloquism - Aug 29, 2015 You had one job Ali 😏 To not put DO in front of %userConsole% #Folded * - Advertisement - Aug 29, 2015 Regarding the top bit you'd need to if /I every comman * - 'Palladium - Aug 29, 2015 (Aug 29, 2015 08:24 AM)White Light Wrote: It's literally just Oh, lol, I didn't think about that one. Also, is there a way to disable the error message if a incorrect command is entered? * - White Light - Aug 29, 2015 (Aug 29, 2015 10:32 PM)Ali. Wrote: Oh, lol, I didn't think about that one. Redirect STDERR to nul. Code %whateveritwasimnotbotheringtolook% 2>nul* - Hackoo - Aug 30, 2015 Hi 🤝 Try something like that : PHP Code * - 'Palladium - Aug 31, 2015 Thanks WhiteLight, but how do I retrieve the output and put it into a variable? I would also like it to not output the command output at all. * - annikk.exe - Aug 31, 2015 Parse it! :> Code @ECHO OFFI have an echo %output% command here, I know you said you don't want it to display but it's just to show that the output is indeed now contained inside a variable. * - 'Palladium - Sep 1, 2015 Thanks Annikk but I have a slight problem, since I am capturing the output of that said so command and then externally outputting it, I'm actually not really executing it, how could I perform the actual command on certain commands such as the colour and title commands (and much more)? I can't think of a solution! You can test this by doing the command "title hi" It won't capture or doing anything other than echoing " ". This commands needs to be executed and logged into the console. My code right now. Code @ECHO OFF* - annikk.exe - Sep 1, 2015 (Sep 1, 2015 02:25 AM)Ali. Wrote: Thanks Annikk but I have a slight problem, since I am capturing the output of that said so command and then externally outputting it, I'm actually not really executing it, how could I perform the actual command on certain commands such as the colour and title commands (and much more)? I can't think of a solution! You can test this by doing the command "title hi" It won't capture or doing anything other than echoing " ". This commands needs to be executed and logged into the console. Actually, when you parse a command within a for loop, the command is executed. Consider this example: Code @ECHO OFF![]() ::purr:: * - 'Palladium - Sep 1, 2015 (Sep 1, 2015 04:14 AM)annikk.exe Wrote: Actually, when you parse a command within a for loop, the command is executed.How could I output it to the console log without echoing " "? (my console script). * - annikk.exe - Sep 1, 2015 What is "it"? Output what to the console log? Also please clarify what you mean by the console log... do you mean the cmd window, or some text file? * - 'Palladium - Sep 1, 2015 (Sep 1, 2015 04:40 AM)annikk.exe Wrote: What is "it"?"it" = nothing, in your script it says "The output is ", I do not want it to display " ", I want it to display command parameter such as "TITLE Hi". The console "log" is the main script I'm working on which is in page 1 of this THREAD. When you enter something into the console in that script, it will log it and you can see it in the window. * - annikk.exe - Sep 1, 2015 (Sep 1, 2015 04:47 AM)Ali. Wrote: "it" = nothing, in your script it says "The output is ", I do not want it to display " ", I want it to display command parameter such as "TITLE Hi". So... echo the %userConsole% variable then? Code @ECHO OFF |