Menu
  • HOME
  • TAGS

Current charset of the windows script host

shell,vbscript,jscript,wsh,wscript

The Windows codepage can be determined via WMI, by reading the CodeSet property of the Win32_OperatingSystem class. There are several ways for reading properties of that class. In batch scripts you'd use the commandline executable wmic: wmic os get codeset In VBScript you could shell out and use the same...

How to list the target path of all My Network Places in vbs?

vbscript,wscript

Use .GetLink.Path: If objItem.IsFileSystem Then Wscript.Echo objItem.Name, " =>", objItem.GetLink.Path End If ...

“System cannot find the file specified” when trying to run PowerShell script

javascript,powershell,activex,wscript

Your code doesn't work, because the string concatenation operator in JavaScript is +, not &. Change this: WshShell.Run("powershell.exe -file " & scriptID & " " & vmName & " " & checkstate, 7, true); into this: WshShell.Run("powershell.exe -file " + scriptID + " " + vmName + " " +...

Can I get the return value of Shell.Application's ShellExecute?

vbscript,wscript

IShellDispatch2.ShellExecute method Performs a specified operation on a specified file. Syntax IShellDispatch2.ShellExecute(sFile [, vArguments] [, vDirectory] [, vOperation] [, vShow]) Parameters sFile Required. String that contains the name of the file on which ShellExecute will perform the action specified by vOperation. vArguments Optional. Variant that contains the parameter values...

GhostScript on IIS6 causing Permission Denied error

vbscript,ghostscript,permission-denied,wscript

To solve this issue... Go to IIS Manager --> Local Computer -->Application Pools. Then, right click on DefaultAppPool then select Properties Under the Identity Tab, check how your system is running them An update evidently changed mine from "Configurable" so I can list what I want and set it to...

Scripting Git Commands in Windows

git,scripting,jscript,wscript,cscript

Is there a clear alternative that doesn't involve some third party tool installation? Yes, git uses a bash shell which you can use in git alias, or in git script. Even on windows, you can define a file name git-xxx, with a shell script in it (which will be...

Unknown error - cmdlet Invoke-SCScript

c#,powershell,wscript,cmdlet

OK, Instead of command2 = command2 + string.Format(" ${1} = $shell.CreateShortcut(\"C:\\ClusterStorage\\Volume2\\test.lnk\"); ${1}.TargetPath = \"{0}\\_VMBackup\\{2}\\{1}\"; ${1}.Save();", backupDir, vm.Name, date); Try command2 = command2 + string.Format(" $shortc = $shell.CreateShortcut(\"C:\\ClusterStorage\\Volume2\\test.lnk\"); $shortc.TargetPath = \"{0}\\_VMBackup\\{2}\\{1}\"; $shortc.Save();", backupDir, vm.Name, date); command2 = "'" + command2 + "'" This did not work and neither did a lot...

Does wscript.exe require a path to a script to work?

vba,wscript

No, you can't just pass code into wscript.exe or cscript.exe. You'll have to write it to a file and pass the filename to wscript.exe or cscript.exe.

How to delay in VB Script?

visual-studio-2010,vbscript,delay,setup-project,wscript

The first statement, WScript.Sleep 1000, does work. Your error must be somewhere else. Proof Create a file test.vbs on your desktop: WScript.Echo Time() WScript.Sleep 2000 WScript.Echo Time() Run as follows: C:\Users\...\Desktop>cscript test.vbs Microsoft (R) Windows Script Host Version 5.8 Copyright (C) Microsoft Corporation. All rights reserved. 11:31:34 11:31:36 Note the...

Execute JScript code stored as a string and pass arguments

eval,jscript,wscript

The problem is caused by the []. WScript.Arguments is an object (provided by the script host runtime), but not an array. To access its elements, you have to use (), i.e. call its Item() function. Evidence: var jsStr; jsStr = "WScript.Echo('a', WScript.Arguments(0));"; eval(jsStr); jsStr = "WScript.Echo('b', WScript.Arguments.Item(0));"; eval(jsStr); var expr;...