Skip to content
View in the app

A better way to browse. Learn more.

MSFN

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

cmd file close automatically when there is a "if"

Featured Replies

Hi, I got a problem on vista and server 2008. I made some .cmd file and everytime it reach an instruction with a if, the cmd.exe close automatically. here is an sample of my file

@echo ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@echo Power Configuration for your laptop
start /wait Settings\cmd\PowerOptions.cmd
@echo ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
if "%COMPUTERNAME%" neq "ME" (
echo Adding your Credentials informations in storage of network password
start /wait Settings\cmd\AddCredentials.cmd
)

As soon as it go down the "if "%COMPUTERNAME%.... it closes.

How to solve this and is there any workaround ?

If i tape this instruction manually it works fine but looks like if I use a bat file it doesn't work.


Have you enabled command extensions? I have no idea about this, but i think they need to be enabled for IF to work properly? This is just a guess.

I do however think you need to include the ELSE command, or ELSE it will fail anyway ?! ;)

  • Author

Yeah i was reading about if extension. I'll try

No need to enable extensions, if you use instead of neq IF NOT no need for ELSE, at least not in the snippet code posted.

Try editing as below:

if NOT "%COMPUTERNAME%"=="ME" (
ECHO INSIDE IF&PAUSE
echo Adding your Credentials informations in storage of network password
ECHO INSIDE IF BEFORE START&PAUSE
start /wait Settings\cmd\AddCredentials.cmd
ECHO INSIDE IF AFTER START&PAUSE
)
ECHO PAST IF&PAUSE

What output you get?

jaclaz

Edited by jaclaz

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.