{"id":14626,"date":"2021-12-15T12:05:46","date_gmt":"2021-12-15T12:05:46","guid":{"rendered":"https:\/\/lgildv5i97.onrocket.site\/answers\/?post_type=question&#038;p=14626"},"modified":"2021-12-15T12:06:27","modified_gmt":"2021-12-15T12:06:27","slug":"how-to-have-user-input-string-with-spaces","status":"publish","type":"question","link":"https:\/\/computing.net\/answers\/programming\/how-to-have-user-input-string-with-spaces\/24331.html","title":{"rendered":"How To Have User Input String With Spaces?"},"content":{"rendered":"<p>I am trying to create a log generator that will allow multiple lines of input from the user and add it to a text file.<\/p>\n<p>Current process (temp log is created constantly during script):<br \/>\n1. Asks for user&#8217;s initials.<br \/>\n2. Asks for problem\/issue (allows for multiple lines of input, until there is a blank line.<br \/>\n3. Does the same as step 2 for resolution.<br \/>\n4. Finishes log and copies from temp to permanent log file.<\/p>\n<p>My problem is that my script limits each line of user input to one word (no spaces allowed).<\/p>\n<p>How can I allow a variable\/string to be input without the user manually adding quotes (&#8220;&#8221;) before and after each line?<\/p>\n<p>@ECHO off<br \/>\nSETLOCAL ENABLEEXTENSIONS<br \/>\nSET ver=1.0.0<br \/>\nCOLOR 4f<br \/>\nTITLE Automatic Log Creator (v.%ver%)&#8230;<br \/>\nSET cp=xcopy \/y \/h<br \/>\nSET dl=del \/q<br \/>\nSET date=%date:~4,2%.%date:~7,2%.%date:~-4%-%time:~-11,2%.%time:~-8,2%<br \/>\nSET if=IF EXIST<br \/>\nSET log=C:\\updates\\Temp.log<br \/>\nSET log2=C:\\updates\\Updates.log<br \/>\nSET spt=___<br \/>\nSET spe=&#8230;<br \/>\nSET spl=&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br \/>\n:: BEGIN SCRIPT<br \/>\n:title<br \/>\ncls<br \/>\nECHO &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\nECHO Welcome to the OEMDD Log Creator<br \/>\nECHO &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\nECHO.<br \/>\n:start<br \/>\nSET \/P USER=Please enter your initials (i.e. NCB)?<br \/>\nECHO.<br \/>\nECHO %spl%&gt;&gt;%log%<br \/>\nECHO # Activity Log on %date% #&gt;&gt;%log%<br \/>\nECHO # Changes made by %USER% #&gt;&gt;%log%<br \/>\nECHO %spl%&gt;&gt;%log%<br \/>\nECHO. &gt;&gt;%log%<br \/>\n::ISSUE LOG<br \/>\n:issue<br \/>\nECHO Issue(s) Addressed:&gt;&gt;%log%<br \/>\nECHO Describe the issue you are addressing (multi-line):<br \/>\nSET ISSUE=nul<br \/>\nSET \/P ISSUE=<br \/>\nif \/i {%issue%}=={nul} (goto :issue-error)<br \/>\nECHO *%issue%&gt;&gt;%log%<br \/>\nif \/i {%issue%}=={%issue%} (goto :issue-next)<br \/>\necho error<br \/>\npause<br \/>\n:issue-next<br \/>\nSET ISSUE=nul<br \/>\nSET \/P ISSUE=<br \/>\nif \/i {%issue%}=={nul} (goto :resolution)<br \/>\nECHO *%issue%&gt;&gt;%log%<br \/>\nif \/i {%issue%}=={%issue%} (goto :issue-next)<br \/>\n:issue-error<br \/>\nECHO You must enter at least 1 line:<br \/>\ngoto :issue-next<\/p>\n<p>::RESOLUTION LOG<br \/>\n:resolution<br \/>\nECHO Action\/Resolution Completed:&gt;&gt;%log%<br \/>\nECHO Describe the actions\/resolution taken (multi-line):<br \/>\nSET RESOLUTION=nul<br \/>\nSET \/P RESOLUTION=<br \/>\nif \/i {%resolution%}=={nul} (goto :resolution-error)<br \/>\nECHO *%resolution%&gt;&gt;%log%<br \/>\nif \/i {%resolution%}=={%resolution%} (goto :resolution-next)<br \/>\necho error<br \/>\npause<br \/>\n:resolution-next<br \/>\nSET RESOLUTION=nul<br \/>\nSET \/P RESOLUTION=<br \/>\nif \/i {%resolution%}=={nul} (goto :end)<br \/>\nECHO *%resolution%&gt;&gt;%log%<br \/>\nif \/i {%resolution%}=={%resolution%} (goto :resolution-next)<br \/>\n:resolution-error<br \/>\nECHO You must enter at least 1 line:<br \/>\ngoto :resolution-next<\/p>\n<p>::FINISH<br \/>\n:end<br \/>\nECHO. &gt;&gt;%log%<br \/>\nECHO %spl%&gt;&gt;%log%<br \/>\nECHO # End changes on %date% #&gt;&gt;%log%<br \/>\nECHO %spl%&gt;&gt;%log%<br \/>\nECHO Thank you, %USER%%spe%<br \/>\nECHO.<br \/>\nECHO Log completed successfully.<br \/>\nTYPE %log%&gt;&gt;%log2%<br \/>\ncls<br \/>\nECHO LOG RESULTS:<br \/>\nECHO.<br \/>\ntype %log%<br \/>\n%dl% %log%<br \/>\nPING localhost -n 10 &gt;nul<br \/>\ngoto :title<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"iawp_total_views":16},"question-category":[55],"question_tags":[],"class_list":["post-14626","question","type-question","status-publish","hentry","question-category-programming"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question\/14626","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question"}],"about":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/types\/question"}],"author":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/comments?post=14626"}],"wp:attachment":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/media?parent=14626"}],"wp:term":[{"taxonomy":"question-category","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question-category?post=14626"},{"taxonomy":"question_tags","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question_tags?post=14626"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}