windows-scripting

Windows Shell Script “is was unexpected at this time.” in Command Prompt

左心房为你撑大大i 提交于 2020-01-03 03:01:26
问题 Very new to this, so I apologize if this is something simple. I am running the following .bat script in Command Prompt for an assignment. @ECHO off TITLE "KnockKnock.bat - The KnockKnock joke game!" COLOR 0E CLS ECHO. ECHO. ECHO. ECHO. ECHO. ECHO. ECHO. ECHO. ECHO. ECHO. SET /p reply="Knock Knock! C:>" CLS IF NOT %reply% == "Who is there?" ( ECHO "Sorry, but you are not playing the game right!" GOTO :EOF) ECHO. ECHO. ECHO. ECHO. ECHO. ECHO. ECHO. ECHO. ECHO. ECHO. SET /p reply="Orange! C:>"

Batch Script Issue - How do I convert the dates or suggest any logic to satisfy the IF statement requirements in the given code?

雨燕双飞 提交于 2019-12-28 04:36:05
问题 I have this already initialized batch script codes running in bat file: @echo off setlocal EnableExtensions DisableDelayedExpansion rem // Define constants here: set "_ROOT=%~dp0." & rem // (common root directory; `%~dp0.` is script's parent, `.` is current) set "_DIR1=%_ROOT%\Directory1" & rem // (1st directory containing files) set "_DIR2=%_ROOT%\Directory2" & rem // (2nd directory containing files) set _MASKS="*INV*." "*SLS*." & rem // (list of quoted file masks) set "_TMP1=%TEMP%\%~n0_1_

VBScript and batch file fails when run by Task Scheduler

眉间皱痕 提交于 2019-12-25 02:06:42
问题 I have a VBScript that checks to see if MS Word is running hidden, makes it visible, then hides it again. here is the script code that works fine when I double click the file in Explorer: dim oWord Dim wshShell, btn Set wshShell = WScript.CreateObject("WScript.Shell") set oWord = getobject(, "Word.Application") if isobject(oWord) then on error goto 0 wshShell.Popup "Word is running, making visible", 7, "ALPS Push print", &H0 + &H40 oWord.visible=true wshShell.Popup "MS Word is now visible" &

using Windows Script Host

十年热恋 提交于 2019-12-23 09:37:31
问题 I am using windows script host for some kind of installer application and I'm creating shortcuts in start menu with it. This problem came up when I switched to x64 environment (win7 ultimate x64+vs2010) I added a reference to Windows Script Host Object Model (from c:\windows\syswow64\wshom.ocx), it generated Interop.IWshRuntimeLibrary dll. I added 'using IWshRuntimeLibrary;' to my .cs files, but when I tried to create WshShell sh = new WshShellClass(); it throws an exception: Could not load

Prompt dialog in WSH using JScript?

时光怂恿深爱的人放手 提交于 2019-12-22 03:09:53
问题 How to open a prompt dialog box in WSH usig JScript?? The only pop-up dialog I've found in the doc is the WshShell.Popup() method. But I need a way to request the user to enter a string, like the window.prompt() method in DOM. Thanks. 回答1: I think the WScript object does not provide such a method however you can show an input box from vbscript running on WSH. So here is one possible solution which lets you call that VB function from within JS! Please note the file extension for the following

Loading the TypeScript compiler into ClearScript, “WScript is undefined”, impossible task?

二次信任 提交于 2019-12-21 04:29:30
问题 I tried using ClearScript to load the TypeScript compiler in order to compile some basic TypeScript code. Unfortunately, when executing the TypeScript compiler source I get this error: 'WScript' is undefined This is the LINQPad program I've used, place the ClearScript dll's and the TypeScript compiler file alongside the .linq program: void Main() { using (var js = new Microsoft.ClearScript.Windows.JScriptEngine(Microsoft.ClearScript.Windows.WindowsScriptEngineFlags.DisableSourceManagement)) {

Is it secure to use a password argument in a Windows command?

做~自己de王妃 提交于 2019-12-18 05:17:17
问题 Imagine that we have a program or script that can take a password (or other sensitive information) argument: > program.exe /password:secret For Linux, best practice generally recommends against specifying the password directly on the command-line because of potential security concerns (the password can appear in the shell's history file and the system's process table): $ ./program.sh --password 'secret' & [1] 4152 $ cat /proc/4152/cmdline /bin/sh./program.sh--passwordsecret However, when

PSEXEC, access denied errors

六月ゝ 毕业季﹏ 提交于 2019-12-17 04:16:11
问题 While I'm using PSEXEC.exe getting 'Access denied' error for remote systems. Any idea about how to solve this? 回答1: Hi i am placing here a summary from many sources online for various solutions to "access is denied" : most information can be found here (including requirements needed) - sysinternal help as someone mentioned add this reg key, and then restart the computer : reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\system /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1

How to shift arguments in batch files when there are more than 10 arguments

ぐ巨炮叔叔 提交于 2019-12-13 17:59:46
问题 I am learning how to write batch files for Windows 7 using the VBScript like native scripting language. I suppose I am not using the Windows Scripting Host or the Power Shell. I am using the simple old style VBScript like syntax. I don't understand how to shift arguments when there are more than 9 arguments (or 10 including the name of the batch file) passed to the batch file. Could you please teach me that? Let us assume that you called my batch file with the following arguments: C:\>call my

Batch script to remove parts of a filename

自闭症网瘾萝莉.ら 提交于 2019-12-13 01:25:52
问题 Help please! I need to remove time stamp and file number off of the filename using a windows batch script. Thank you! Thank you in advance! OLD Filename= CAM168-NOTSET.2013.10.01.18.45.45.882.jpg NEW Filename= CAM168-NOTSET.jpg 回答1: @ECHO OFF SETLOCAL SET "fname=CAM168-NOTSET.2013.10.01.18.45.45.882.jpg" FOR %%i IN ("%fname%") DO FOR /f "delims=." %%j IN ("%%i") DO ECHO REN "%%~i" "%%~j%%~xi" GOTO :EOF New name merely ECHO ed. 回答2: If by "remove time stamp and file number" , you mean remove