Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244 RE: How to display content of .txt file in wscript.echo? 2 tsuji (TechnicalUser)5 Nov 04 10:16Hello TheNewOne,
This is to further illustrate what advised.
[1] As long as you get the share exposed on the local server, you can use fso to read the message file. If not, no.
[2] wscript.echo and/or msgbox do not have scoll bar control, so for message >50 or so line, it would be awkward.
CODEfilespec="\\a0b1c2\test\msgfile.txt" 'servername,share,msgfile
on error resume next
wscript.echo createobject("scripting.filesystemobject").opentextfile(filespec,1,false).readall
if err.number0 then wscript.echo "File not found." : err.clear
on error goto 0(construction deliberately convolute)
[3] For long message, it is then you've found some control supporting scroll bar. Internet-explorer is an option. A simpler approach is to open it in notepad (the downside is that you can edit the message perhaps too easily.)
CODEfilespec="\\a0b1c2\test\msgfile.txt" 'servername,share,msgfile
on error resume next
createobject("wscript.shell").run "notepad.exe " & filespec
if err.number0 then wscript.echo "File not found." : err.clear(construction deliberately convolute)
regards - tsuji RE: How to display content of .txt file in wscript.echo? TheNewOne (TechnicalUser)(OP)8 Nov 04 02:20THX Tsuji for excelent solution. Script works perfect. Star for you. Thx PHV and mrmovie for advice. You rock guys!!!
Jure, Slovenija googletag.cmd.push(function() googletag.display('div-gpt-ad-1406030581151-2'); ); Red Flag This PostPlease let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.
CancelRed Flag SubmittedThank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.
I am writing a Batch Script that creates a VB Script by echoing each line and directing the output to the created file. It works for the most part, except for two lines that get Command Line variables and uses it as VBS variables. This is the code:
But what happens is the Batch Script is it just echos the entire line, including >> uninstallBeta.vbs. Any idea why this happens? I have similar lines for creating other VBS and Batch scripts that I think work just fine doing it this way. I have checked for typos and found none. It works just fine in Command Prompt, but not in a Batch Script.
The Percent processing in phase 1 happens before ^ escape processing in phase 2. So the parser looks for an environment variable named USERPROFILE^, and fails to find it. So that expands to an empty string, leaving:
Next, the carets are processed to escape characters in phase two. The important thing is the first ^" is an escaped quote, so the characters after are not quoted. The next ^^ is an escaped caret. Than follows the first quote that is not escaped, so all characters afterward are quoted. I signify that with Q above each quoted character:
Note that the rules are different from the command line. There is no mechanism to truly escape a % within the command line, and the command line preserves %undefinedVar% text if the variable is undefined. However, you can effectively prevent expansion of the variable by including one or more ^ between the percents so that the variable is not found. The caret then disappears in phase 2. But the first quote needs to be escaped so that the internal ^ disappears. And the last quote must be escaped so that the redirection is active.
It writes the numbers to the screen in cscript and to a popup window
when using wscript.If you run wscript (or just excute it - I assume it will use wscript in
this case), why would you use one over the other - or does it matter?Thanks,Tom
Correct, wscript.exe is default, but you can change the default if you want:cscript /? gives among other things this://H:CScript Changes the default script host to CScript.exe
//H:WScript Changes the default script host to WScript.exe (default)
MsgBox function
-us/script56/html/vsfctmsgbox.aspIf you want more control of the buttons (e.g. you want a Cancel button as well),
you will need to use MsgBox (se link above).
If this is not the case, here is some views on the difference:If your scripts gives a lot of output, and you use wscript.exe, you might get a
bit tired of pushing OK on a lot of message dialogs ;-)Where script.exe really shines, is if your vbscript editor integrates with
cscript.exe and redirects the output from cscript into an own output window. E.g.
PrimalScript can do this. One extra bonus in Primalscript, if I have an error in
the script, I just push enter (or double click with the mouse) on the error line,
and PrimalScript will switch to the source script file window and set the cursor
on the line where the error was.
But, if you do not use an "advanced" editor or doesn't have scripts that echoes a
lot to the screen, or you don't want to add buttons, it doesn't matter which one
you use.
--
torgeir
Save your script to the DeploymentShare\scripts folder and name it ZTIComputername.wsf. Next, boot your machine from your Lite-Touch media. Then in WinPE navigate to Z:\scripts and type:
I ended up creating a custom variable in the gather.xml and checked its value if it was blank or more than 7 character it defined it so my techs would notice, or it truncated the variable it it was more than 7 characters and defined the osdcomputername as my text plus the new variable. Thanks for the idea.
I tried out the script as shown, with the edits. It shows a result with the properly-concatenated serial number, but it does not set this output as a variable (such as SerialNumber or something else that c. How would this be done?
Andrew, would you happne to know how to echo the inputted username in credentials.. the same username you have to put in the admin or username field when inputting username, password and domain in order to start the mdt process?
The below example shows how to embed VBSCRIPT code output in BGINFO. First we create a VBSCRIPT file called comp.vbs that has the following content. (Credit for the script goes to Moral Volcano)
If you were to launch this script, you will get an error message saying that there is a type mismatch, this is caused by the line that starts with the word Echo because Echo is not a valid vbscript command, normally you would use the wscript.echo command. But for the use with BGINFO we must use the above syntax as this is what gets parsed back to BGINFO
When Access runs a macro, screen updating often shows information not essential to the functioning of the macro. When you set the Echo On argument to No, the macro runs without updating the screen. When the macro finishes, Access automatically turns echo back on and repaints the window. The No setting for the Echo On argument doesn't affect the functionality of the macro or its results.
The Echo action doesn't suppress the display of modal dialog boxes, such as error messages, or pop-up forms, such as property sheets. You can use dialog boxes and pop-up forms to gather or display information, even if echo is turned off. To suppress all message or dialog boxes except error message boxes and dialog boxes that require the user to enter information, use the SetWarnings action.
If you turn echo off, you can use the Hourglass action to change the mouse pointer into an hourglass icon (or whatever mouse pointer icon you've set for "Busy") to provide a visual indication that the macro is running.
The following macro opens the Add Products form from a button on the Suppliers form. It shows the use of the Echo, Close, OpenForm, SetValue, and GoToControl actions. The SetValue action sets the Supplier ID control on the Products form to the current supplier on the Suppliers form. The GoToControl action then moves the focus to the Category ID field, where you can begin to enter data for the new product. This macro should be attached to the Add Products button on the Suppliers form.
c80f0f1006