VBScript is scheduled for deprecation! So?


Prog is, I assume,
c:\windows\system32\cscript.exe
Argument might be something like
"D:\Desktop\JScript-Intermediary-TestedOK\Test-JScript.js" "D:\Desktop\JScript-Intermediary-TestedOK\TakeAScreenshot.bat - 5.lnk"

Just put the the script path in the "Program/script" field and the path to the lnk file in the "Add arguments" field.

Windows will automatically run it via WScript.exe.
 

My Computer My Computer

At a glance

Windows 10/11
OS
Windows 10/11
Computer type
Laptop
Manufacturer/Model
Acer
Just put the the script path in the "Program/script" field and the path to the lnk file in the "Add arguments" field.

Les,

I had also tried that.
Prog
"D:\Desktop\JScript-Intermediary-TestedOK\Test-JScript.js"
Argument
"D:\Desktop\JScript-Intermediary-TestedOK\TakeAScreenshot.bat - 5.lnk"

I get a js error
error and comparison.webp

I suspect it's because there is a space in the Argument.


Denis
 

My Computer My Computer

At a glance

Windows 11 Home x64 Version 25H2 Build 26200....
OS
Windows 11 Home x64 Version 25H2 Build 26200.9168
@Try3 The error indicates that no argument got passed to the script, so TS didn't pass anything. Eliminate spaces and it should all work fine. The script works with spaces, but TS is another matter.
 

My Computer My Computer

At a glance

Windows 10/11
OS
Windows 10/11
Computer type
Laptop
Manufacturer/Model
Acer
If you're not distributing your code, you don't have to change anything. VBScript will remain available to install via Optional Features in the same way you can install other old stuff such as SMB 1
Initially, yes, but it will eventually be removed (Phase 3)

 

My Computer My Computer

At a glance

Windows 11 Enterprise 25H2
OS
Windows 11 Enterprise 25H2
@Try3 The error indicates that no argument got passed to the script, so TS didn't pass anything. Eliminate spaces and it should all work fine. The script works with spaces, but TS is another matter.
Yes, it passed my pre-TS testing.
Thanks for your efforts.
Many of my scripts make use of one or more passed arguments so the use of spaces is unavoidable.
- My existing vbs solution can cope with that.
- The conhost solution can also cope with that so I'll proceed with that approach.
- I just picked my test script because it was the first one that came to hand. I'm lucky I picked it so that I learnt about the issue straightaway.

When I do anything new in VBS I end up opening a new box of quotation marks and sprinkling them all over the place as I test for arguments with spaces & with ampersands. I thought it might be the same with JScript but a brief online search suggested that it was much more complicated than that.


All the best,
Denis
 

My Computer My Computer

At a glance

Windows 11 Home x64 Version 25H2 Build 26200....
OS
Windows 11 Home x64 Version 25H2 Build 26200.9168
Yes, it passed my pre-TS testing.
Thanks for your efforts.
Many of my scripts make use of one or more passed arguments so the use of spaces is unavoidable.
- My existing vbs solution can cope with that.
- The conhost solution can also cope with that so I'll proceed with that approach.
- I just picked my test script because it was the first one that came to hand. I'm lucky I picked it so that I learnt about the issue straightaway.

When I do anything new in VBS I end up opening a new box of quotation marks and sprinkling them all over the place as I test for arguments with spaces & with ampersands. I thought it might be the same with JScript but a brief online search suggested that it was much more complicated than that.


All the best,
Denis
Anything you can do in VBScript, you can do in JScript. It's not more complicated. It's just different syntax. If you post a sample, I'll convert it for you. Your workflow can remain 100% the same.
 

My Computer My Computer

At a glance

Windows 10/11
OS
Windows 10/11
Computer type
Laptop
Manufacturer/Model
Acer
If you post a sample, I'll convert it for you

CreateObject("WScript.Shell").Run chr(34) & "C:\Tools\Backup\CoreFiles\CoreFilesBackup.lnk" & Chr(34), 7
Well, given the space issue, I'll pretend that it's
CreateObject("WScript.Shell").Run chr(34) & "C:\Tools\Backup\CoreFiles\CoreFilesBackup 5.lnk" & Chr(34), 7


Denis
 

My Computer My Computer

At a glance

Windows 11 Home x64 Version 25H2 Build 26200....
OS
Windows 11 Home x64 Version 25H2 Build 26200.9168
With all the issues like this that come up, maybe they should schedule Windows for deprecation! :lmao:
 

My Computers My Computers

  • At a glance

    Win 11 Pro 25H2, Build 26200.9168Intel Core i5 14500, 14th Generation64GB DDR4GeForce RTX 4060
    OS
    Win 11 Pro 25H2, Build 26200.9168
    Computer type
    PC/Desktop
    Manufacturer/Model
    Home Brew
    CPU
    Intel Core i5 14500, 14th Generation
    Motherboard
    Gigabyte B760M G P WIFI
    Memory
    64GB DDR4
    Graphics Card(s)
    GeForce RTX 4060
    Sound Card
    Chipset Realtek
    Monitor(s) Displays
    LG 45" Ultragear & Acer 24" 1080p
    Screen Resolution
    5120x1440 & 1920x1080
    Hard Drives
    Crucial P310 2TB 2280 PCIe Gen4 3D NAND NVMe M.2 SSD (O/S)
    Silicon Power 2TB US75 NVMe PCIe Gen4 M.2 2280 SSD (backup)
    Crucial BX500 2TB 3D NAND (2nd backup)
    Seagate 4TB Ironwolf, rotating HDD archive files
    External off-line backup Drives: 2 NVMe 4TB drives in external enclosures
    PSU
    Thermaltake Toughpower GF3 750W
    Case
    LIAN LI LANCOOL 216 E-ATX PC Case
    Cooling
    Lots of fans!
    Keyboard
    Microsoft Comfort Curve 2000
    Mouse
    Logitech G305
    Internet Speed
    Verizon FiOS 1GB
    Browser
    Firefox
    Antivirus
    Malware Bytes & Windows Defender Security
  • At a glance

    Win 11 Pro 25H2, Build 26200.9168Intel Core i5 1440032GB DDR5Intel 700 Embedded GPU
    Operating System
    Win 11 Pro 25H2, Build 26200.9168
    Computer type
    PC/Desktop
    Manufacturer/Model
    Home Brew
    CPU
    Intel Core i5 14400
    Motherboard
    Gigabyte B760M DS3H AX
    Memory
    32GB DDR5
    Graphics card(s)
    Intel 700 Embedded GPU
    Sound Card
    Realtek Embedded
    Monitor(s) Displays
    27" HP 1080p
    Screen Resolution
    1920x1080
    Hard Drives
    Crucial P310 2TB 2280 PCIe Gen4 eD NAND PCIe SSD
    Samsung EVO 990 2TB NVMe Gen4 SSD
    Samsung 2TB SATA SSD
    PSU
    Thermaltake Smart BM3 650W
    Case
    Okinos Micro ATX Case
    Cooling
    Fans
    Keyboard
    Microsoft Comfort Curve 2000
    Mouse
    Logitech G305
    Internet Speed
    Verizon FiOS 1GB
    Browser
    Firefox
    Antivirus
    Malware Bytes & Windows Defender Security
  • Nimo N171 17" Laptop, (Intel i3-1215U, 16GB RAM, 2TB NVMe, Win11 Pro)
    Acemagic Vista Mini PC V1 (Intel N150, 16GB RAM, 1TB NVMe, Win11 Pro)
    HP ENVY h8-1540t, (24GB RAM, 2TB SSD, 2TB HDD, Win11 Pro)
Well, given the space issue, I'll pretend that it's
CreateObject("WScript.Shell").Run chr(34) & "C:\Tools\Backup\CoreFiles\CoreFilesBackup 5.lnk" & Chr(34), 7
I'm on mobile right now, so I can't verify, but this looks correct:

Code:
var WshShell = new ActiveXObject("WScript.Shell");
WshShell.Run('"C:\\Tools\\Backup\\CoreFiles\\CoreFilesBackup 5.lnk"', 7);
 

My Computer My Computer

At a glance

Windows 10/11
OS
Windows 10/11
Computer type
Laptop
Manufacturer/Model
Acer
You've got to do better than this guys...
If you would have called them 'client script' and 'server script' instead of VBscript and JavaScript, in the first place, we wouldn't have had this convo. I would say this, so you don't 'space out'. "If you remove the program(s), you will need to upgrade all the equipment at the server, and change the systems at all the terminals, and be really really nice to all the patrons, handing free stuff out, and making sure their systems work better than the servers systems who will probably build custom machines that are impossible to operate anyway!"
 

My Computer My Computer

At a glance

Windows Eleven
OS
Windows Eleven
Computer type
PC/Desktop
The length of the command line becomes an issue. You... have been assigned a handler. Tell me persay, what do I do, if my handler is not doing what I need them to do?
 

My Computer My Computer

At a glance

Windows Eleven
OS
Windows Eleven
Computer type
PC/Desktop
You've got to do better than this guys...
Who do you think you're talking to? MS? We're all just users helping each other out.


Denis
 

My Computer My Computer

At a glance

Windows 11 Home x64 Version 25H2 Build 26200....
OS
Windows 11 Home x64 Version 25H2 Build 26200.9168
Sorry... Ghost Town U.S.A. was my fault. I bit blitted it. Poor advanced server technologies!! #$%& Always looking ahead... into the future we go... unhinged and packing a very primitive weapon...
 

My Computer My Computer

At a glance

Windows Eleven
OS
Windows Eleven
Computer type
PC/Desktop
You've got to do better than this guys...
If you would have called them 'client script' and 'server script' instead of VBscript and JavaScript, in the first place, we wouldn't have had this convo.
It's not JavaScript. It's JScript. It's equivalent to VBScript. Both are Microsoft scripting languages that can be run via Windows Script Host or via MSHTML. We're not dealing with server side stuff, such ASP, in this discussion. Were just talking about desktop scripting and Task Scheduler.
 

My Computer My Computer

At a glance

Windows 10/11
OS
Windows 10/11
Computer type
Laptop
Manufacturer/Model
Acer
I'm on mobile right now, so I can't verify, but this looks correct:

Code:
var WshShell = new ActiveXObject("WScript.Shell");
WshShell.Run('"C:\\Tools\\Backup\\CoreFiles\\CoreFilesBackup 5.lnk"', 7);

Les,

Yes, the JScript runs manually.
But every time, when run from TS, I get this challenge after which execution just seems to stop dead as if the selection process has lost the file it's trying to run.
interupt.webp

I think I'll just go with garlin's conhost solution for the TS intermediary tasks.
It's always been my loose intention to replace other uses with PS scripts.
I also have some VBS calls from VBA. I'll have to look into replacing those with PS calls instead.


All the best,
Denis
 

My Computer My Computer

At a glance

Windows 11 Home x64 Version 25H2 Build 26200....
OS
Windows 11 Home x64 Version 25H2 Build 26200.9168
Les,

Yes, the JScript runs manually.
But every time, when run from TS, I get this challenge after which execution just seems to stop dead as if the selection process has lost the file it's trying to run.
View attachment 163302

I think I'll just go with garlin's conhost solution for the TS intermediary tasks.
It's always been my loose intention to replace other uses with PS scripts.
I also have some VBS calls from VBA. I'll have to look into replacing those with PS calls instead.


All the best,
Denis
I'm guessing your task runs as a different user, maybe SYSTEM? Should just be a matter of making that association as that user. Will help more when I'm back at a PC
 

My Computer My Computer

At a glance

Windows 10/11
OS
Windows 10/11
Computer type
Laptop
Manufacturer/Model
Acer
I'm guessing your task runs as a different user, maybe SYSTEM? Should just be a matter of making that association as that user. Will help more when I'm back at a PC
No, it's the same user.
I think TS needs something about cscript js files to be set up before it can be used even though cscript js files run without any action having to be taken.


Denis
 

My Computer My Computer

At a glance

Windows 11 Home x64 Version 25H2 Build 26200....
OS
Windows 11 Home x64 Version 25H2 Build 26200.9168
No, it's the same user.
I think TS needs something about cscript js files to be set up before it can be used even though cscript js files run without any action having to be taken.
Hmm, the association should only have to be done once per user. Maybe once using wscript.exe and again using cscript.exe.

Edit: @Try3 I couldn't replicate the issue. My test.js script ran fine from Task Scheduler using cscript.exe or wscript.exe.
 
Last edited:

My Computer My Computer

At a glance

Windows 10/11
OS
Windows 10/11
Computer type
Laptop
Manufacturer/Model
Acer
Hmm, the association should only have to be done once per user. Maybe once using wscript.exe and again using cscript.exe.

Edit: @Try3 I couldn't replicate the issue. My test.js script ran fine from Task Scheduler using cscript.exe or wscript.exe.
TS has always had its quirks.
The .js file runs fine on its own so its file association does not seem to have any problems and .js is listed correctly in my %PathExt% variable.
js file association.webp

PathExt.webp
It's only when running the .js from TS that any problem appears - and it's every time, the interruption does not offer any 'always use this app' option.
I'll just have to live with it.


All the best,
Denis
 

My Computer My Computer

At a glance

Windows 11 Home x64 Version 25H2 Build 26200....
OS
Windows 11 Home x64 Version 25H2 Build 26200.9168
File Type Associations are a per-user setting. Are you running the task as SYSTEM or Administrator (different user profile & FTA’s).
 

My Computer My Computer

At a glance

Windows 7
OS
Windows 7
Back
Top Bottom